Changeset 32796 in vbox
- Timestamp:
- Sep 28, 2010 2:54:41 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 66245
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/gvmm.h
r32489 r32796 31 31 #include <VBox/types.h> 32 32 #include <VBox/sup.h> 33 #include <iprt/cpuset.h> /* RTCPUSET_MAX_CPUS */ 33 34 34 35 RT_C_DECLS_BEGIN … … 105 106 106 107 /** 108 * Per host cpu statistics. 109 */ 110 typedef struct GVMMSTATSHOSTCPU 111 { 112 /** The CPU ID. */ 113 RTCPUID idCpu; 114 /** The CPU's set index. */ 115 uint32_t idxCpuSet; 116 /** The desired PPT frequency. */ 117 uint32_t uDesiredHz; 118 /** The current PPT timer frequency. */ 119 uint32_t uTimerHz; 120 /** The number of times the PPT was changed. */ 121 uint32_t cChanges; 122 /** The number of times the PPT was started. */ 123 uint32_t cStarts; 124 } GVMMSTATSHOSTCPU; 125 /** Pointer to the GVMM per host CPU statistics. */ 126 typedef GVMMSTATSHOSTCPU *PGVMMSTATSHOSTCPU; 127 128 /** 107 129 * The GMM statistics. 108 130 */ … … 110 132 { 111 133 /** The VM statistics if a VM was specified. */ 112 GVMMSTATSSCHED SchedVM;134 GVMMSTATSSCHED SchedVM; 113 135 /** The sum statistics of all VMs accessible to the caller. */ 114 GVMMSTATSSCHED SchedSum;136 GVMMSTATSSCHED SchedSum; 115 137 /** The number of VMs accessible to the caller. */ 116 uint32_t cVMs;138 uint32_t cVMs; 117 139 /** The number of emulation threads in those VMs. */ 118 uint32_t cEMTs; 140 uint32_t cEMTs; 141 /** Padding. */ 142 uint32_t u32Padding; 143 /** The number of valid entries in aHostCpus. */ 144 uint32_t cHostCpus; 145 /** Per host CPU statistics. */ 146 GVMMSTATSHOSTCPU aHostCpus[RTCPUSET_MAX_CPUS]; 119 147 } GVMMSTATS; 120 148 /** Pointer to the GVMM statistics. */ -
trunk/include/VBox/stam.h
r30684 r32796 216 216 /** Percentage. */ 217 217 STAMUNIT_PCT, 218 /** Hertz. */ 219 STAMUNIT_HZ, 218 220 /** The end (exclusive). */ 219 221 STAMUNIT_END -
trunk/include/VBox/uvm.h
r32190 r32796 125 125 struct STAMUSERPERVM s; 126 126 #endif 127 uint8_t padding[ 256];127 uint8_t padding[4096]; 128 128 } stam; 129 129 -
trunk/include/VBox/vm.h
r32137 r32796 166 166 struct TMCPU s; 167 167 #endif 168 uint8_t padding[ 256]; /* multiple of 64 */168 uint8_t padding[384]; /* multiple of 64 */ 169 169 } tm; 170 170 … … 207 207 208 208 /** Align the following members on page boundrary. */ 209 uint8_t abAlignment2[ 192];209 uint8_t abAlignment2[64]; 210 210 211 211 /** PGM part. */ -
trunk/src/VBox/VMM/STAM.cpp
r28800 r32796 179 179 180 180 /** 181 * The GVMM mapping records .181 * The GVMM mapping records - sans the host cpus. 182 182 */ 183 183 static const STAMR0SAMPLE g_aGVMMStats[] = … … 213 213 { RT_UOFFSETOF(GVMMSTATS, cVMs), STAMTYPE_U32, STAMUNIT_CALLS, "/GVMM/VMs", "The number of VMs accessible to the caller." }, 214 214 { RT_UOFFSETOF(GVMMSTATS, cEMTs), STAMTYPE_U32, STAMUNIT_CALLS, "/GVMM/EMTs", "The number of emulation threads." }, 215 { RT_UOFFSETOF(GVMMSTATS, cHostCpus), STAMTYPE_U32, STAMUNIT_CALLS, "/GVMM/HostCPUs", "The number of host CPUs." }, 215 216 }; 216 217 … … 783 784 fGVMMMatched = true; 784 785 } 786 if (!fGVMMMatched) 787 { 788 /** @todo match cpu leaves some rainy day. */ 789 } 785 790 786 791 /* GMM */ … … 943 948 */ 944 949 stamR3SnapshotPrintf(&State, "<Statistics>\n"); 945 STAM_LOCK_RD(pUVM);946 950 int rc = stamR3EnumU(pUVM, pszPat, true /* fUpdateRing0 */, stamR3SnapshotOne, &State); 947 STAM_UNLOCK_RD(pUVM);948 951 stamR3SnapshotPrintf(&State, "</Statistics>\n"); 949 952 … … 1262 1265 Args.pfnPrintf = stamR3EnumLogPrintf; 1263 1266 1264 STAM_LOCK_RD(pUVM);1265 1267 stamR3EnumU(pUVM, pszPat, true /* fUpdateRing0 */, stamR3PrintOne, &Args); 1266 STAM_UNLOCK_RD(pUVM);1267 1268 return VINF_SUCCESS; 1268 1269 } … … 1315 1316 Args.pfnPrintf = stamR3EnumRelLogPrintf; 1316 1317 1317 STAM_LOCK_RD(pUVM);1318 1318 stamR3EnumU(pUVM, pszPat, true /* fUpdateRing0 */, stamR3PrintOne, &Args); 1319 STAM_UNLOCK_RD(pUVM);1320 1319 return VINF_SUCCESS; 1321 1320 } … … 1368 1367 Args.pfnPrintf = stamR3EnumPrintf; 1369 1368 1370 STAM_LOCK_RD(pUVM);1371 1369 stamR3EnumU(pUVM, pszPat, true /* fUpdateRing0 */, stamR3PrintOne, &Args); 1372 STAM_UNLOCK_RD(pUVM);1373 1370 return VINF_SUCCESS; 1374 1371 } … … 1538 1535 Args.pvUser = pvUser; 1539 1536 1540 STAM_LOCK_RD(pUVM); 1541 int rc = stamR3EnumU(pUVM, pszPat, true /* fUpdateRing0 */, stamR3EnumOne, &Args); 1542 STAM_UNLOCK_RD(pUVM); 1543 return rc; 1537 return stamR3EnumU(pUVM, pszPat, true /* fUpdateRing0 */, stamR3EnumOne, &Args); 1544 1538 } 1545 1539 … … 1669 1663 * is specified. 1670 1664 * 1671 * The call must own at least a read lock to the STAM data. 1665 * The call may lock STAM for writing before calling this function, however do 1666 * not lock it for reading as this function may need to write lock STAM. 1672 1667 * 1673 1668 * @returns The rc from the callback. 1674 * @param pUVM Pointer to the user mode VM structure.1669 * @param pUVM Pointer to the user mode VM structure. 1675 1670 * @param pszPat Pattern. 1676 1671 * @param fUpdateRing0 Update the ring-0 . … … 1680 1675 * @param pvArg User parameter for the callback. 1681 1676 */ 1682 static int stamR3EnumU(PUVM pUVM, const char *pszPat, bool fUpdateRing0, int (*pfnCallback)(PSTAMDESC pDesc, void *pvArg), void *pvArg) 1677 static int stamR3EnumU(PUVM pUVM, const char *pszPat, bool fUpdateRing0, 1678 int (*pfnCallback)(PSTAMDESC pDesc, void *pvArg), void *pvArg) 1683 1679 { 1684 1680 int rc = VINF_SUCCESS; … … 1692 1688 stamR3Ring0StatsUpdateU(pUVM, "*"); 1693 1689 1694 PSTAMDESC pCur = pUVM->stam.s.pHead; 1690 STAM_LOCK_RD(pUVM); 1691 PSTAMDESC pCur = pUVM->stam.s.pHead; 1695 1692 while (pCur) 1696 1693 { … … 1702 1699 pCur = pCur->pNext; 1703 1700 } 1701 STAM_UNLOCK_RD(pUVM); 1704 1702 } 1705 1703 … … 1712 1710 stamR3Ring0StatsUpdateU(pUVM, pszPat); 1713 1711 1712 STAM_LOCK_RD(pUVM); 1714 1713 /** @todo This needs to be optimized since the GUI is using this path for the VM info dialog. 1715 1714 * Note that it's doing exact matching. Organizing the samples in a tree would speed up thing … … 1722 1721 break; 1723 1722 } 1723 STAM_UNLOCK_RD(pUVM); 1724 1724 } 1725 1725 … … 1744 1744 stamR3Ring0StatsUpdateMultiU(pUVM, papszExpressions, cExpressions); 1745 1745 1746 STAM_LOCK_RD(pUVM); 1746 1747 unsigned iExpression = 0; 1747 1748 for (PSTAMDESC pCur = pUVM->stam.s.pHead; pCur; pCur = pCur->pNext) … … 1752 1753 break; 1753 1754 } 1755 STAM_UNLOCK_RD(pUVM); 1754 1756 1755 1757 RTMemTmpFree(papszExpressions); … … 1773 1775 g_aGVMMStats[i].enmType, STAMVISIBILITY_ALWAYS, g_aGVMMStats[i].pszName, 1774 1776 g_aGVMMStats[i].enmUnit, g_aGVMMStats[i].pszDesc); 1777 pUVM->stam.s.cRegisteredHostCpus = 0; 1775 1778 } 1776 1779 … … 1791 1794 * Updates the ring-0 statistics. 1792 1795 * 1793 * The ring-0 statistics aren't directly addressable from ring-3 and 1794 * must becopied when needed.1796 * The ring-0 statistics aren't directly addressable from ring-3 and must be 1797 * copied when needed. 1795 1798 * 1796 1799 * @param pUVM Pointer to the user mode VM structure. … … 1811 1814 break; 1812 1815 } 1816 if (!fUpdate) 1817 { 1818 /** @todo check the cpu leaves - rainy day. */ 1819 } 1813 1820 if (fUpdate) 1814 1821 { … … 1819 1826 int rc = SUPR3CallVMMR0Ex(pVM->pVMR0, NIL_VMCPUID, VMMR0_DO_GVMM_QUERY_STATISTICS, 0, &Req.Hdr); 1820 1827 if (RT_SUCCESS(rc)) 1828 { 1821 1829 pUVM->stam.s.GVMMStats = Req.Stats; 1830 1831 /* 1832 * Check if the number of host CPUs has changed (it will the first 1833 * time around and normally never again). 1834 */ 1835 if (RT_UNLIKELY(pUVM->stam.s.GVMMStats.cHostCpus > pUVM->stam.s.cRegisteredHostCpus)) 1836 { 1837 STAM_LOCK_WR(pUVM); 1838 if (RT_UNLIKELY(pUVM->stam.s.GVMMStats.cHostCpus > pUVM->stam.s.cRegisteredHostCpus)) 1839 { 1840 uint32_t cCpus = pUVM->stam.s.GVMMStats.cHostCpus; 1841 for (uint32_t iCpu = pUVM->stam.s.cRegisteredHostCpus; iCpu < cCpus; iCpu++) 1842 { 1843 char szName[120]; 1844 size_t cchBase = RTStrPrintf(szName, sizeof(szName), "/GVMM/HostCpus/%u", iCpu); 1845 stamR3RegisterU(pUVM, &pUVM->stam.s.GVMMStats.aHostCpus[iCpu].idCpu, NULL, NULL, 1846 STAMTYPE_U32, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_NONE, "Host CPU ID"); 1847 strcpy(&szName[cchBase], "/idxCpuSet"); 1848 stamR3RegisterU(pUVM, &pUVM->stam.s.GVMMStats.aHostCpus[iCpu].idxCpuSet, NULL, NULL, 1849 STAMTYPE_U32, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_NONE, "CPU Set index"); 1850 strcpy(&szName[cchBase], "/DesiredHz"); 1851 stamR3RegisterU(pUVM, &pUVM->stam.s.GVMMStats.aHostCpus[iCpu].uDesiredHz, NULL, NULL, 1852 STAMTYPE_U32, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_HZ, "The desired frequency"); 1853 strcpy(&szName[cchBase], "/CurTimerHz"); 1854 stamR3RegisterU(pUVM, &pUVM->stam.s.GVMMStats.aHostCpus[iCpu].uTimerHz, NULL, NULL, 1855 STAMTYPE_U32, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_HZ, "The current timer frequency"); 1856 strcpy(&szName[cchBase], "/PPTChanges"); 1857 stamR3RegisterU(pUVM, &pUVM->stam.s.GVMMStats.aHostCpus[iCpu].cChanges, NULL, NULL, 1858 STAMTYPE_U32, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_OCCURENCES, "RTTimerChangeInterval calls"); 1859 strcpy(&szName[cchBase], "/PPTStarts"); 1860 stamR3RegisterU(pUVM, &pUVM->stam.s.GVMMStats.aHostCpus[iCpu].cStarts, NULL, NULL, 1861 STAMTYPE_U32, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_OCCURENCES, "RTTimerStart calls"); 1862 } 1863 pUVM->stam.s.cRegisteredHostCpus = cCpus; 1864 } 1865 STAM_UNLOCK_WR(pUVM); 1866 } 1867 } 1822 1868 } 1823 1869 } … … 1851 1897 case STAMUNIT_NS_PER_OCCURENCE: return "ns/time"; 1852 1898 case STAMUNIT_PCT: return "%"; 1899 case STAMUNIT_HZ: return "Hz"; 1853 1900 1854 1901 default: … … 1889 1936 Args.pfnPrintf = stamR3EnumDbgfPrintf; 1890 1937 1891 STAM_LOCK_RD(pUVM); 1892 int rc = stamR3EnumU(pUVM, cArgs ? paArgs[0].u.pszString : NULL, true /* fUpdateRing0 */, stamR3PrintOne, &Args); 1893 STAM_UNLOCK_RD(pUVM); 1894 1895 return rc; 1938 return stamR3EnumU(pUVM, cArgs ? paArgs[0].u.pszString : NULL, true /* fUpdateRing0 */, stamR3PrintOne, &Args); 1896 1939 } 1897 1940 -
trunk/src/VBox/VMM/STAMInternal.h
r28800 r32796 103 103 /** The copy of the GVMM statistics. */ 104 104 GVMMSTATS GVMMStats; 105 /** The number of registered host CPU leaves. */ 106 uint32_t cRegisteredHostCpus; 105 107 } STAMUSERPERVM; 106 108 /** Pointer to the STAM data kept in the UVM. */ -
trunk/src/VBox/VMM/TM.cpp
r32504 r32796 505 505 506 506 /* 507 * Gather the Host Hz configuration values. 508 */ 509 rc = CFGMR3QueryU32Def(pCfgHandle, "HostHzMax", &pVM->tm.s.cHostHzMax, 20000); 510 if (RT_FAILURE(rc)) 511 return VMSetError(pVM, rc, RT_SRC_POS, 512 N_("Configuration error: Failed to querying uint32_t value \"HostHzMax\"")); 513 514 rc = CFGMR3QueryU32Def(pCfgHandle, "HostHzFudgeFactorTimerCpu", &pVM->tm.s.cPctHostHzFudgeFactorTimerCpu, 111); 515 if (RT_FAILURE(rc)) 516 return VMSetError(pVM, rc, RT_SRC_POS, 517 N_("Configuration error: Failed to querying uint32_t value \"HostHzFudgeFactorTimerCpu\"")); 518 519 rc = CFGMR3QueryU32Def(pCfgHandle, "HostHzFudgeFactorOtherCpu", &pVM->tm.s.cPctHostHzFudgeFactorOtherCpu, 110); 520 if (RT_FAILURE(rc)) 521 return VMSetError(pVM, rc, RT_SRC_POS, 522 N_("Configuration error: Failed to querying uint32_t value \"HostHzFudgeFactorOtherCpu\"")); 523 524 rc = CFGMR3QueryU32Def(pCfgHandle, "HostHzFudgeFactorCatchUp100", &pVM->tm.s.cPctHostHzFudgeFactorCatchUp100, 300); 525 if (RT_FAILURE(rc)) 526 return VMSetError(pVM, rc, RT_SRC_POS, 527 N_("Configuration error: Failed to querying uint32_t value \"HostHzFudgeFactorCatchUp100\"")); 528 529 rc = CFGMR3QueryU32Def(pCfgHandle, "HostHzFudgeFactorCatchUp200", &pVM->tm.s.cPctHostHzFudgeFactorCatchUp200, 250); 530 if (RT_FAILURE(rc)) 531 return VMSetError(pVM, rc, RT_SRC_POS, 532 N_("Configuration error: Failed to querying uint32_t value \"HostHzFudgeFactorCatchUp200\"")); 533 534 rc = CFGMR3QueryU32Def(pCfgHandle, "HostHzFudgeFactorCatchUp400", &pVM->tm.s.cPctHostHzFudgeFactorCatchUp400, 200); 535 if (RT_FAILURE(rc)) 536 return VMSetError(pVM, rc, RT_SRC_POS, 537 N_("Configuration error: Failed to querying uint32_t value \"HostHzFudgeFactorCatchUp400\"")); 538 539 /* 507 540 * Start the timer (guard against REM not yielding). 508 541 */ … … 546 579 STAM_REL_REG( pVM,(void*)&pVM->tm.s.offVirtualSync, STAMTYPE_U64, "/TM/VirtualSync/CurrentOffset", STAMUNIT_NS, "The current offset. (subtract GivenUp to get the lag)"); 547 580 STAM_REL_REG_USED(pVM,(void*)&pVM->tm.s.offVirtualSyncGivenUp, STAMTYPE_U64, "/TM/VirtualSync/GivenUp", STAMUNIT_NS, "Nanoseconds of the 'CurrentOffset' that's been given up and won't ever be attemted caught up with."); 581 STAM_REL_REG( pVM,(void*)&pVM->tm.s.uMaxHzHint, STAMTYPE_U32, "/TM/MaxHzHint", STAMUNIT_HZ, "Max guest timer frequency hint."); 548 582 549 583 #ifdef VBOX_WITH_STATISTICS … … 637 671 STAMR3RegisterF(pVM, &pVM->aCpus[i].tm.s.StatNsTotal, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_NS, "Resettable: Total CPU run time.", "/TM/CPU/%02u", i); 638 672 STAMR3RegisterF(pVM, &pVM->aCpus[i].tm.s.StatNsExecuting, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_NS_PER_OCCURENCE, "Resettable: Time spent executing guest code.", "/TM/CPU/%02u/PrfExecuting", i); 673 STAMR3RegisterF(pVM, &pVM->aCpus[i].tm.s.StatNsExecLong, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_NS_PER_OCCURENCE, "Resettable: Time spent executing guest code - long hauls.", "/TM/CPU/%02u/PrfExecLong", i); 674 STAMR3RegisterF(pVM, &pVM->aCpus[i].tm.s.StatNsExecShort, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_NS_PER_OCCURENCE, "Resettable: Time spent executing guest code - short streches.", "/TM/CPU/%02u/PrfExecShort", i); 675 STAMR3RegisterF(pVM, &pVM->aCpus[i].tm.s.StatNsExecTiny, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_NS_PER_OCCURENCE, "Resettable: Time spent executing guest code - tiny bits.", "/TM/CPU/%02u/PrfExecTiny", i); 639 676 STAMR3RegisterF(pVM, &pVM->aCpus[i].tm.s.StatNsHalted, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_NS_PER_OCCURENCE, "Resettable: Time spent halted.", "/TM/CPU/%02u/PrfHalted", i); 640 677 STAMR3RegisterF(pVM, &pVM->aCpus[i].tm.s.StatNsOther, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_NS_PER_OCCURENCE, "Resettable: Time spent in the VMM or preempted.", "/TM/CPU/%02u/PrfOther", i); -
trunk/src/VBox/VMM/TMInternal.h
r32484 r32796 426 426 /** Alignment */ 427 427 bool afAlignment2[3]; 428 /** @cfgm{TM/HostHzMax, uint32_t, Hz, 0, UINT32_MAX, 20000} 429 * The max host Hz frequency hint returned by TMCalcHostTimerFrequency. */ 430 uint32_t cHostHzMax; 431 /** @cfgm{TM/HostHzFudgeFactorTimerCpu, uint32_t, Hz, 0, UINT32_MAX, 111} 432 * The number of Hz TMCalcHostTimerFrequency adds for the timer CPU. */ 433 uint32_t cPctHostHzFudgeFactorTimerCpu; 434 /** @cfgm{TM/HostHzFudgeFactorOtherCpu, uint32_t, Hz, 0, UINT32_MAX, 110} 435 * The number of Hz TMCalcHostTimerFrequency adds for the other CPUs. */ 436 uint32_t cPctHostHzFudgeFactorOtherCpu; 437 /** @cfgm{TM/HostHzFudgeFactorCatchUp100, uint32_t, Hz, 0, UINT32_MAX, 300} 438 * The fudge factor (expressed in percent) that catch-up percentages below 439 * 100% is multiplied by. */ 440 uint32_t cPctHostHzFudgeFactorCatchUp100; 441 /** @cfgm{TM/HostHzFudgeFactorCatchUp200, uint32_t, Hz, 0, UINT32_MAX, 250} 442 * The fudge factor (expressed in percent) that catch-up percentages 443 * 100%-199% is multiplied by. */ 444 uint32_t cPctHostHzFudgeFactorCatchUp200; 445 /** @cfgm{TM/HostHzFudgeFactorCatchUp400, uint32_t, Hz, 0, UINT32_MAX, 200} 446 * The fudge factor (expressed in percent) that catch-up percentages 447 * 200%-399% is multiplied by. */ 448 uint32_t cPctHostHzFudgeFactorCatchUp400; 428 449 429 450 /** The UTC offset in ns. … … 645 666 /** Resettable version of cNsExecuting. */ 646 667 STAMPROFILE StatNsExecuting; 668 /** Long execution intervals. */ 669 STAMPROFILE StatNsExecLong; 670 /** Short execution intervals . */ 671 STAMPROFILE StatNsExecShort; 672 /** Tiny execution intervals . */ 673 STAMPROFILE StatNsExecTiny; 647 674 /** Resettable version of cNsHalted. */ 648 675 STAMPROFILE StatNsHalted; -
trunk/src/VBox/VMM/VMMAll/TMAll.cpp
r32572 r32796 201 201 # if defined(VBOX_WITH_STATISTICS) || defined(VBOX_WITH_NS_ACCOUNTING_STATS) 202 202 STAM_REL_PROFILE_ADD_PERIOD(&pVCpu->tm.s.StatNsExecuting, cNsExecutingDelta); 203 if (cNsExecutingDelta < 5000) 204 STAM_REL_PROFILE_ADD_PERIOD(&pVCpu->tm.s.StatNsExecTiny, cNsExecutingDelta); 205 else if (cNsExecutingDelta < 50000) 206 STAM_REL_PROFILE_ADD_PERIOD(&pVCpu->tm.s.StatNsExecShort, cNsExecutingDelta); 207 else 208 STAM_REL_PROFILE_ADD_PERIOD(&pVCpu->tm.s.StatNsExecLong, cNsExecutingDelta); 203 209 STAM_REL_COUNTER_ADD(&pVCpu->tm.s.StatNsTotal, cNsTotalNew - pVCpu->tm.s.cNsTotal); 204 210 int64_t const cNsOtherNewDelta = cNsOtherNew - pVCpu->tm.s.cNsOther; … … 1443 1449 { 1444 1450 TMTIMER_ASSERT_CRITSECT(pTimer); 1451 1452 uint32_t const uHzOldHint = pTimer->uHzHint; 1445 1453 pTimer->uHzHint = uHzHint; 1454 1446 1455 PVM pVM = pTimer->CTX_SUFF(pVM); 1447 if (uHzHint >= pVM->tm.s.uMaxHzHint) 1456 uint32_t const uMaxHzHint = pVM->tm.s.uMaxHzHint; 1457 if ( uHzHint > uMaxHzHint 1458 || uHzOldHint >= uMaxHzHint) 1448 1459 ASMAtomicWriteBool(&pVM->tm.s.fHzHintNeedsUpdating, true); 1460 1449 1461 return VINF_SUCCESS; 1450 1462 } … … 2350 2362 uint32_t uHz = tmGetFrequencyHint(pVM); 2351 2363 2352 /* Catch up. */ 2364 /* Catch up, we have to be more aggressive than the % indicates at the 2365 beginning of the effort. */ 2353 2366 if (ASMAtomicUoReadBool(&pVM->tm.s.fVirtualSyncCatchUp)) 2354 2367 { … … 2356 2369 if (ASMAtomicReadBool(&pVM->tm.s.fVirtualSyncCatchUp)) 2357 2370 { 2371 if (u32Pct <= 100) 2372 u32Pct = u32Pct * pVM->tm.s.cPctHostHzFudgeFactorCatchUp100 / 100; 2373 else if (u32Pct <= 200) 2374 u32Pct = u32Pct * pVM->tm.s.cPctHostHzFudgeFactorCatchUp200 / 100; 2375 else if (u32Pct <= 400) 2376 u32Pct = u32Pct * pVM->tm.s.cPctHostHzFudgeFactorCatchUp400 / 100; 2358 2377 uHz *= u32Pct + 100; 2359 2378 uHz /= 100; … … 2361 2380 } 2362 2381 2363 /* Warp drive */2382 /* Warp drive. */ 2364 2383 if (ASMAtomicUoReadBool(&pVM->tm.s.fVirtualWarpDrive)) 2365 2384 { … … 2373 2392 2374 2393 /* Fudge factor. */ 2375 /** @todo make this configurable. */2376 #if 0 /* what's wrong with this expression? I end up with uHz = 0 after this multiplication... */2377 uHz *= 110 + pVCpu->idCpu == pVM->tm.s.idTimerCpu;2378 #else2379 2394 if (pVCpu->idCpu == pVM->tm.s.idTimerCpu) 2380 uHz *= 111;2395 uHz *= pVM->tm.s.cPctHostHzFudgeFactorTimerCpu; 2381 2396 else 2382 uHz *= 110; 2383 #endif 2397 uHz *= pVM->tm.s.cPctHostHzFudgeFactorOtherCpu; 2384 2398 uHz /= 100; 2385 2399 2386 //LogAlways(("TMCalcHostTimerFrequency->%u\n", uHz)); 2400 /* Make sure it isn't too high. */ 2401 if (uHz > pVM->tm.s.cHostHzMax) 2402 uHz = pVM->tm.s.cHostHzMax; 2403 2387 2404 return uHz; 2388 2405 } -
trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp
r32572 r32796 154 154 * are added at iHzHistory. This is updated approximately every 155 155 * GVMMHOSTCPU_PPT_HIST_INTERVAL_NS by the timer callback. */ 156 uint32_t aHzHistory[ 32];156 uint32_t aHzHistory[8]; 157 157 /** Statistics counter for recording the number of interval changes. */ 158 uint 64_t cChanges;158 uint32_t cChanges; 159 159 /** Statistics counter for recording the number of timer starts. */ 160 uint 64_t cStarts;160 uint32_t cStarts; 161 161 } Ppt; 162 162 #endif /* GVMM_SCHED_WITH_PPT */ … … 2182 2182 * callback here. 2183 2183 */ 2184 if (uHz > 20000)2185 uHz = 20000;2184 if (uHz > 16384) 2185 uHz = 16384; /** @todo add a query method for this! */ 2186 2186 if (RT_UNLIKELY( uHz > ASMAtomicReadU32(&pCpu->Ppt.uDesiredHz) 2187 2187 && uHz >= pCpu->Ppt.uMinHz … … 2308 2308 } 2309 2309 } 2310 2311 /* 2312 * Copy out the per host CPU statistics. 2313 */ 2314 uint32_t iDstCpu = 0; 2315 uint32_t cSrcCpus = pGVMM->cHostCpus; 2316 for (uint32_t iSrcCpu = 0; iSrcCpu < cSrcCpus; iSrcCpu++) 2317 { 2318 if (pGVMM->aHostCpus[iSrcCpu].idCpu != NIL_RTCPUID) 2319 { 2320 pStats->aHostCpus[iDstCpu].idCpu = pGVMM->aHostCpus[iSrcCpu].idCpu; 2321 pStats->aHostCpus[iDstCpu].idxCpuSet = pGVMM->aHostCpus[iSrcCpu].idxCpuSet; 2322 #ifdef GVMM_SCHED_WITH_PPT 2323 pStats->aHostCpus[iDstCpu].uDesiredHz = pGVMM->aHostCpus[iSrcCpu].Ppt.uDesiredHz; 2324 pStats->aHostCpus[iDstCpu].uTimerHz = pGVMM->aHostCpus[iSrcCpu].Ppt.uTimerHz; 2325 pStats->aHostCpus[iDstCpu].cChanges = pGVMM->aHostCpus[iSrcCpu].Ppt.cChanges; 2326 pStats->aHostCpus[iDstCpu].cStarts = pGVMM->aHostCpus[iSrcCpu].Ppt.cStarts; 2327 #else 2328 pStats->aHostCpus[iDstCpu].uDesiredHz = 0; 2329 pStats->aHostCpus[iDstCpu].uTimerHz = 0; 2330 pStats->aHostCpus[iDstCpu].cChanges = 0; 2331 pStats->aHostCpus[iDstCpu].cStarts = 0; 2332 #endif 2333 iDstCpu++; 2334 } 2335 } 2336 pStats->cHostCpus = iDstCpu; 2310 2337 2311 2338 gvmmR0UsedUnlock(pGVMM);
Note:
See TracChangeset
for help on using the changeset viewer.