Changeset 31600 in vbox for trunk/src/VBox
- Timestamp:
- Aug 12, 2010 2:17:05 PM (14 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGM.cpp
r31593 r31600 631 631 static DECLCALLBACK(int) pgmR3CmdAssertCR3(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs, PDBGCVAR pResult); 632 632 # endif 633 # ifdef DEBUG_sandervl 634 static DECLCALLBACK(int) pgmR3CmdCountPhysWrites(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs, PDBGCVAR pResult); 635 # endif 633 636 static DECLCALLBACK(int) pgmR3CmdPhysToFile(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs, PDBGCVAR pResult); 634 637 #endif … … 653 656 }; 654 657 658 # ifdef DEBUG_sandervl 659 static const DBGCVARDESC g_aPgmCountPhysWritesArgs[] = 660 { 661 /* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */ 662 { 1, 1, DBGCVAR_CAT_STRING, 0, "enabled", "on/off." }, 663 { 1, 1, DBGCVAR_CAT_NUMBER_NO_RANGE, 0, "interval", "Interval in ms." }, 664 }; 665 # endif 666 655 667 /** Command descriptors. */ 656 668 static const DBGCCMD g_aCmds[] = … … 661 673 { "pgmerror", 0, 1, &g_aPgmErrorArgs[0], 1, NULL, 0, pgmR3CmdError, "", "Enables inject runtime of errors into parts of PGM." }, 662 674 { "pgmerroroff", 0, 1, &g_aPgmErrorArgs[0], 1, NULL, 0, pgmR3CmdError, "", "Disables inject runtime errors into parts of PGM." }, 663 # ifdef VBOX_STRICT675 # ifdef VBOX_STRICT 664 676 { "pgmassertcr3", 0, 0, NULL, 0, NULL, 0, pgmR3CmdAssertCR3, "", "Check the shadow CR3 mapping." }, 665 #endif 666 #if defined(VBOX_STRICT) && HC_ARCH_BITS == 64 677 # if HC_ARCH_BITS == 64 667 678 { "pgmcheckduppages", 0, 0, NULL, 0, NULL, 0, pgmR3CmdCheckDuplicatePages, "", "Check for duplicate pages in all running VMs." }, 668 679 { "pgmsharedmodules", 0, 0, NULL, 0, NULL, 0, pgmR3CmdShowSharedModules, "", "Print shared modules info." }, 669 #endif 680 # endif 681 # endif 682 # ifdef DEBUG_sandervl 683 { "pgmcountphyswrites", 2, 2, &g_aPgmCountPhysWritesArgs[0], 2, NULL, 0, pgmR3CmdCountPhysWrites, "", "Count physical page writes."}, 684 # endif 670 685 { "pgmsyncalways", 0, 0, NULL, 0, NULL, 0, pgmR3CmdSyncAlways, "", "Toggle permanent CR3 syncing." }, 671 686 { "pgmphystofile", 1, 2, &g_aPgmPhysToFileArgs[0], 2, NULL, 0, pgmR3CmdPhysToFile, "", "Save the physical memory to file." }, … … 1656 1671 rc = STAMR3RegisterF(pVM, a, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, c, b); \ 1657 1672 AssertRC(rc); 1673 1674 #ifdef DEBUG_sandervl 1675 PGM_REG_COUNTER(&pPGM->StatRZFTPhysPageWrite, "/PGM/FT/RZ/PageWrite", "The number of times a physical page was written to (FT stats)."); 1676 PGM_REG_COUNTER(&pPGM->StatR3FTPhysPageWrite, "/PGM/FT/R3/PageWrite", "The number of times a physical page was written to (FT stats)."); 1677 #endif 1658 1678 1659 1679 PGMSTATS *pStats = pVM->pgm.s.pStatsR3; … … 4287 4307 return VINF_SUCCESS; 4288 4308 } 4309 4310 /** 4311 * Internal timer callback function. 4312 * 4313 * @param pVM The VM. 4314 * @param pTimer The timer handle. 4315 * @param pvUser User argument specified upon timer creation. 4316 */ 4317 DECLCALLBACK(void) pgmR3PhysWriteCountTMCallback(PVM pVM, PTMTIMER pTimer, void *pvUser) 4318 { 4319 uint32_t uInterval = (uint32_t) pvUser; 4320 4321 if (pVM->pgm.s.fCountingPhysWrites) 4322 { 4323 pgmR3PoolClearAll(pVM, true/* fFlushRemTlb */); 4324 4325 /* Program next invocation. */ 4326 int rc = TMTimerSetMillies(pVM->pgm.s.pPhysWritesCountTimer, uInterval); 4327 AssertRC(rc); 4328 } 4329 } 4330 4331 # ifdef DEBUG_sandervl 4332 /** 4333 * The '.pgmcountphyswrites' command. 4334 * 4335 * @returns VBox status. 4336 * @param pCmd Pointer to the command descriptor (as registered). 4337 * @param pCmdHlp Pointer to command helper functions. 4338 * @param pVM Pointer to the current VM (if any). 4339 * @param paArgs Pointer to (readonly) array of arguments. 4340 * @param cArgs Number of arguments in the array. 4341 */ 4342 static DECLCALLBACK(int) pgmR3CmdCountPhysWrites(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs, PDBGCVAR pResult) 4343 { 4344 /* 4345 * Validate input. 4346 */ 4347 if (!pVM) 4348 return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: The command requires a VM to be selected.\n"); 4349 if ( cArgs != 2 4350 || paArgs[0].enmType != DBGCVAR_TYPE_STRING 4351 || paArgs[1].enmType != DBGCVAR_CAT_NUMBER_NO_RANGE) 4352 return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: parser error, invalid arguments.\n"); 4353 4354 if (!strcmp(paArgs[0].u.pszString, "off")) 4355 { 4356 if (!pVM->pgm.s.fCountingPhysWrites) 4357 return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: not enabled!\n"); 4358 4359 TMTimerStop(pVM->pgm.s.pPhysWritesCountTimer); 4360 TMR3TimerDestroy(pVM->pgm.s.pPhysWritesCountTimer); 4361 pVM->pgm.s.pPhysWritesCountTimer = NULL; 4362 pVM->pgm.s.fCountingPhysWrites = false; 4363 return VINF_SUCCESS; 4364 } 4365 else 4366 if (strcmp(paArgs[0].u.pszString, "on")) 4367 return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: Invalid 1st argument '%s', must be 'on' or 'off'.\n", paArgs[0].u.pszString); 4368 4369 if ( paArgs[1].u.u64Number < 10 4370 || paArgs[1].u.u64Number > 1000) 4371 return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: Invalid 2nd argument '%d', must be between 10 and 1000 ms.\n", paArgs[1].u.u64Number); 4372 4373 int rc = TMR3TimerCreateInternal(pVM, TMCLOCK_REAL, pgmR3PhysWriteCountTMCallback, (void *)(uint32_t)paArgs[1].u.u64Number, "Physical page write counting timer", &pVM->pgm.s.pPhysWritesCountTimer); 4374 if (RT_FAILURE(rc)) 4375 return rc; 4376 4377 pVM->pgm.s.fCountingPhysWrites = true; 4378 rc = TMTimerSetMillies(pVM->pgm.s.pPhysWritesCountTimer, paArgs[1].u.u64Number); 4379 AssertRC(rc); 4380 return VINF_SUCCESS; 4381 } 4382 # endif /* DEBUG_sandervl */ 4383 4289 4384 #endif /* VBOX_STRICT */ 4290 4385 -
trunk/src/VBox/VMM/PGMInternal.h
r31593 r31600 3141 3141 /** @} */ 3142 3142 3143 #ifdef VBOX_STRICT 3144 PTMTIMERR3 pPhysWritesCountTimer; 3145 bool fCountingPhysWrites; 3146 uint8_t u8Alignment[7]; 3147 3148 STAMCOUNTER StatR3FTPhysPageWrite; /**< R3: The number of times a physical page was written to (FT stats) */ 3149 STAMCOUNTER StatRZFTPhysPageWrite; /**< RC/R0: The number of times a physical page was written to (FT stats) */ 3150 #endif 3151 3143 3152 #ifdef VBOX_WITH_STATISTICS 3144 3153 /** @name Statistics on the heap. -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r31593 r31600 1000 1000 } 1001 1001 } 1002 /** @todo else: WTFare we here? */1002 /** @todo else: why are we here? */ 1003 1003 1004 1004 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && defined(VBOX_STRICT) … … 1880 1880 ) 1881 1881 #endif /* else: CSAM not active */ 1882 1882 PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], PdeSrc, PteSrc, pShwPage, iPTDst); 1883 1883 Log2(("SyncPage: 4K+ %RGv PteSrc:{P=%d RW=%d U=%d raw=%08llx} PteDst=%08llx%s\n", 1884 1884 GCPtrCurPage, PteSrc.n.u1Present, … … 2141 2141 2142 2142 PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], PdeSrc, PteSrc, pShwPage, iPTDst); 2143 #ifdef VBOX_STRICT 2144 if (pVM->pgm.s.fCountingPhysWrites) 2145 pPTDst->a[iPTDst].n.u1Write = 0; 2146 #endif 2143 2147 2144 2148 Log2(("SyncPage: 4K+ %RGv PteSrc:{P=%d RW=%d U=%d raw=%08llx} PteDst=%08llx%s\n", … … 2163 2167 RTGCPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT); 2164 2168 GSTPTE PteSrc; 2169 2170 #ifdef DEBUG_sandervl 2171 if ( pVM->pgm.s.fCountingPhysWrites 2172 && ((uErr & (X86_TRAP_PF_RW|X86_TRAP_PF_P)) == X86_TRAP_PF_RW)) 2173 { 2174 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat, FTPhysPageWrite)); 2175 } 2176 #endif 2165 2177 2166 2178 /* Fake the page table entry */
Note:
See TracChangeset
for help on using the changeset viewer.