Changeset 39917 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Jan 31, 2012 2:04:52 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75992
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/STAM.cpp
r39078 r39917 218 218 219 219 /** 220 * The GMM mapping records. 221 */ 222 static const STAMR0SAMPLE g_aGMMStats[] = 223 { 224 { RT_UOFFSETOF(GMMSTATS, cMaxPages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/cMaxPages", "The maximum number of pages GMM is allowed to allocate." }, 225 { RT_UOFFSETOF(GMMSTATS, cReservedPages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/cReservedPages", "The number of pages that has been reserved." }, 226 { RT_UOFFSETOF(GMMSTATS, cOverCommittedPages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/cOverCommittedPages", "The number of pages that we have over-committed in reservations." }, 227 { RT_UOFFSETOF(GMMSTATS, cAllocatedPages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/cAllocatedPages", "The number of actually allocated (committed if you like) pages." }, 228 { RT_UOFFSETOF(GMMSTATS, cSharedPages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/cSharedPages", "The number of pages that are shared. A subset of cAllocatedPages." }, 229 { RT_UOFFSETOF(GMMSTATS, cDuplicatePages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/cDuplicatePages", "The number of pages that are actually shared between VMs." }, 230 { RT_UOFFSETOF(GMMSTATS, cLeftBehindSharedPages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/cLeftBehindSharedPages", "The number of pages that are shared that has been left behind by VMs not doing proper cleanups." }, 231 { RT_UOFFSETOF(GMMSTATS, cBalloonedPages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/cBalloonedPages", "The number of current ballooned pages." }, 232 { RT_UOFFSETOF(GMMSTATS, cChunks), STAMTYPE_U32, STAMUNIT_PAGES, "/GMM/cChunks", "The number of allocation chunks." }, 233 { RT_UOFFSETOF(GMMSTATS, cFreedChunks), STAMTYPE_U32, STAMUNIT_PAGES, "/GMM/cFreedChunks", "The number of freed chunks ever." }, 234 { RT_UOFFSETOF(GMMSTATS, cShareableModules), STAMTYPE_U32, STAMUNIT_PAGES, "/GMM/cShareableModules", "The number of shareable modules." }, 235 { RT_UOFFSETOF(GMMSTATS, VMStats.Reserved.cBasePages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/VM/Reserved/cBasePages", "The amount of base memory (RAM, ROM, ++) reserved by the VM." }, 236 { RT_UOFFSETOF(GMMSTATS, VMStats.Reserved.cShadowPages), STAMTYPE_U32, STAMUNIT_PAGES, "/GMM/VM/Reserved/cShadowPages", "The amount of memory reserved for shadow/nested page tables." }, 237 { RT_UOFFSETOF(GMMSTATS, VMStats.Reserved.cFixedPages), STAMTYPE_U32, STAMUNIT_PAGES, "/GMM/VM/Reserved/cFixedPages", "The amount of memory reserved for fixed allocations like MMIO2 and the hyper heap." }, 238 { RT_UOFFSETOF(GMMSTATS, VMStats.Allocated.cBasePages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/VM/Allocated/cBasePages", "The amount of base memory (RAM, ROM, ++) allocated by the VM." }, 239 { RT_UOFFSETOF(GMMSTATS, VMStats.Allocated.cShadowPages), STAMTYPE_U32, STAMUNIT_PAGES, "/GMM/VM/Allocated/cShadowPages", "The amount of memory allocated for shadow/nested page tables." }, 240 { RT_UOFFSETOF(GMMSTATS, VMStats.Allocated.cFixedPages), STAMTYPE_U32, STAMUNIT_PAGES, "/GMM/VM/Allocated/cFixedPages", "The amount of memory allocated for fixed allocations like MMIO2 and the hyper heap." }, 241 { RT_UOFFSETOF(GMMSTATS, VMStats.cPrivatePages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/VM/cPrivatePages", "The current number of private pages." }, 242 { RT_UOFFSETOF(GMMSTATS, VMStats.cSharedPages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/VM/cSharedPages", "The current number of shared pages." }, 243 { RT_UOFFSETOF(GMMSTATS, VMStats.cBalloonedPages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/VM/cBalloonedPages", "The current number of ballooned pages." }, 244 { RT_UOFFSETOF(GMMSTATS, VMStats.cMaxBalloonedPages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/VM/cMaxBalloonedPages", "The max number of pages that can be ballooned." }, 245 { RT_UOFFSETOF(GMMSTATS, VMStats.cReqBalloonedPages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/VM/cReqBalloonedPages", "The number of pages we've currently requested the guest to give us." }, 246 { RT_UOFFSETOF(GMMSTATS, VMStats.cReqActuallyBalloonedPages),STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/VM/cReqActuallyBalloonedPages","The number of pages the guest has given us in response to the request." }, 247 { RT_UOFFSETOF(GMMSTATS, VMStats.cReqDeflatePages), STAMTYPE_U64, STAMUNIT_PAGES, "/GMM/VM/cReqDeflatePages", "The number of pages we've currently requested the guest to take back." }, 248 { RT_UOFFSETOF(GMMSTATS, VMStats.enmPolicy), STAMTYPE_U32, STAMUNIT_NONE, "/GMM/VM/enmPolicy", "The current over-commit policy." }, 249 { RT_UOFFSETOF(GMMSTATS, VMStats.enmPriority), STAMTYPE_U32, STAMUNIT_NONE, "/GMM/VM/enmPriority", "The VM priority for arbitrating VMs in low and out of memory situation." }, 250 { RT_UOFFSETOF(GMMSTATS, VMStats.fBallooningEnabled), STAMTYPE_BOOL, STAMUNIT_NONE, "/GMM/VM/fBallooningEnabled", "Whether ballooning is enabled or not." }, 251 { RT_UOFFSETOF(GMMSTATS, VMStats.fBallooningEnabled), STAMTYPE_BOOL, STAMUNIT_NONE, "/GMM/VM/fSharedPagingEnabled", "Whether shared paging is enabled or not." }, 252 { RT_UOFFSETOF(GMMSTATS, VMStats.fBallooningEnabled), STAMTYPE_BOOL, STAMUNIT_NONE, "/GMM/VM/fMayAllocate", "Whether the VM is allowed to allocate memory or not." }, 253 }; 254 255 256 /** 220 257 * Initializes the STAM. 221 258 * … … 636 673 case STAMTYPE_X8: 637 674 case STAMTYPE_X8_RESET: 675 case STAMTYPE_BOOL: 676 case STAMTYPE_BOOL_RESET: 638 677 case STAMTYPE_CALLBACK: 639 678 break; … … 765 804 /* ring-0 */ 766 805 GVMMRESETSTATISTICSSREQ GVMMReq; 767 //GMMRESETSTATISTICSSREQGMMReq;806 GMMRESETSTATISTICSSREQ GMMReq; 768 807 bool fGVMMMatched = !pszPat || !*pszPat; 769 //bool fGMMMatched= fGVMMMatched;808 bool fGMMMatched = fGVMMMatched; 770 809 if (fGVMMMatched) 810 { 771 811 memset(&GVMMReq.Stats, 0xff, sizeof(GVMMReq.Stats)); 812 memset(&GMMReq.Stats, 0xff, sizeof(GMMReq.Stats)); 813 } 772 814 else 773 815 { … … 779 821 780 822 /* GVMM */ 781 memset(&GVMMReq.Stats, 0, sizeof(GVMMReq.Stats));823 RT_ZERO(GVMMReq.Stats); 782 824 for (unsigned i = 0; i < RT_ELEMENTS(g_aGVMMStats); i++) 783 825 if (stamR3MultiMatch(papszExpressions, cExpressions, NULL, g_aGVMMStats[i].pszName)) … … 792 834 793 835 /* GMM */ 794 // memset(&GMMReq.Stats, 0, sizeof(GMMReq.Stats));795 //for (unsigned i = 0; i < RT_ELEMENTS(g_aGMMStats); i++)796 //if (stamR3MultiMatch(papszExpressions, cExpressions, NULL, g_aGMMStats[i].pszName))797 //{798 //*((uint8_t *)&GMMReq.Stats + g_aGMMStats[i].offVar) = 0xff;799 //fGMMMatched = true;800 //}836 RT_ZERO(GMMReq.Stats); 837 for (unsigned i = 0; i < RT_ELEMENTS(g_aGMMStats); i++) 838 if (stamR3MultiMatch(papszExpressions, cExpressions, NULL, g_aGMMStats[i].pszName)) 839 { 840 *((uint8_t *)&GMMReq.Stats + g_aGMMStats[i].offVar) = 0xff; 841 fGMMMatched = true; 842 } 801 843 802 844 RTMemTmpFree(papszExpressions); … … 805 847 806 848 STAM_LOCK_WR(pUVM); 849 807 850 if (fGVMMMatched) 808 851 { 809 852 PVM pVM = pUVM->pVM; 810 GVMMReq.Hdr.cbReq = sizeof(GVMMReq);853 GVMMReq.Hdr.cbReq = sizeof(GVMMReq); 811 854 GVMMReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 812 GVMMReq.pSession = pVM->pSession;855 GVMMReq.pSession = pVM->pSession; 813 856 rc = SUPR3CallVMMR0Ex(pVM->pVMR0, NIL_VMCPUID, VMMR0_DO_GVMM_RESET_STATISTICS, 0, &GVMMReq.Hdr); 814 857 } 815 858 816 //if (fGMMMatched)817 //{818 //PVM pVM = pUVM->pVM;819 // GMMReq.Hdr.cbReq = sizeof(Req);820 //GMMReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;821 // GMMReq.pSession= pVM->pSession;822 // rc = SUPR3CallVMMR0Ex(pVM->pVMR0, VMMR0_DO_GMM_RESET_STATISTICS, 0, &Req.Hdr);823 //}859 if (fGMMMatched) 860 { 861 PVM pVM = pUVM->pVM; 862 GMMReq.Hdr.cbReq = sizeof(GMMReq); 863 GMMReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 864 GMMReq.pSession = pVM->pSession; 865 rc = SUPR3CallVMMR0Ex(pVM->pVMR0, NIL_VMCPUID, VMMR0_DO_GMM_RESET_STATISTICS, 0, &GMMReq.Hdr); 866 } 824 867 825 868 /* and the reset */ … … 829 872 return rc; 830 873 } 874 831 875 832 876 /** … … 898 942 case STAMTYPE_X64_RESET: 899 943 ASMAtomicXchgU64(pDesc->u.pu64, 0); 944 break; 945 946 case STAMTYPE_BOOL_RESET: 947 ASMAtomicXchgBool(pDesc->u.pf, false); 900 948 break; 901 949 … … 910 958 case STAMTYPE_X64: 911 959 case STAMTYPE_RATIO_U32: 960 case STAMTYPE_BOOL: 912 961 break; 913 962 … … 1092 1141 return VINF_SUCCESS; 1093 1142 stamR3SnapshotPrintf(pThis, "<X64 val=\"%#llx\"", *pDesc->u.pu64); 1143 break; 1144 1145 case STAMTYPE_BOOL: 1146 case STAMTYPE_BOOL_RESET: 1147 if (pDesc->enmVisibility == STAMVISIBILITY_USED && *pDesc->u.pf == false) 1148 return VINF_SUCCESS; 1149 stamR3SnapshotPrintf(pThis, "<BOOL val=\"%RTbool\"", *pDesc->u.pf); 1094 1150 break; 1095 1151 … … 1512 1568 break; 1513 1569 1570 case STAMTYPE_BOOL: 1571 case STAMTYPE_BOOL_RESET: 1572 if (pDesc->enmVisibility == STAMVISIBILITY_USED && *pDesc->u.pf == false) 1573 return VINF_SUCCESS; 1574 pArgs->pfnPrintf(pArgs, "%-32s %s %s\n", pDesc->pszName, *pDesc->u.pf ? "true " : "false ", STAMR3GetUnit(pDesc->enmUnit)); 1575 break; 1576 1514 1577 default: 1515 1578 AssertMsgFailed(("enmType=%d\n", pDesc->enmType)); … … 1779 1842 g_aGVMMStats[i].enmUnit, g_aGVMMStats[i].pszDesc); 1780 1843 pUVM->stam.s.cRegisteredHostCpus = 0; 1844 1845 /* GMM */ 1846 for (unsigned i = 0; i < RT_ELEMENTS(g_aGMMStats); i++) 1847 stamR3RegisterU(pUVM, (uint8_t *)&pUVM->stam.s.GMMStats + g_aGMMStats[i].offVar, NULL, NULL, 1848 g_aGMMStats[i].enmType, STAMVISIBILITY_ALWAYS, g_aGMMStats[i].pszName, 1849 g_aGMMStats[i].enmUnit, g_aGMMStats[i].pszDesc); 1781 1850 } 1782 1851 … … 1809 1878 return; 1810 1879 1811 /* GVMM */ 1880 /* 1881 * GVMM 1882 */ 1812 1883 bool fUpdate = false; 1813 1884 for (unsigned i = 0; i < RT_ELEMENTS(g_aGVMMStats); i++) … … 1870 1941 } 1871 1942 } 1943 1944 /* 1945 * GMM 1946 */ 1947 fUpdate = false; 1948 for (unsigned i = 0; i < RT_ELEMENTS(g_aGMMStats); i++) 1949 if (stamR3MultiMatch(papszExpressions, cExpressions, NULL, g_aGMMStats[i].pszName)) 1950 { 1951 fUpdate = true; 1952 break; 1953 } 1954 if (fUpdate) 1955 { 1956 GMMQUERYSTATISTICSSREQ Req; 1957 Req.Hdr.cbReq = sizeof(Req); 1958 Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 1959 Req.pSession = pVM->pSession; 1960 int rc = SUPR3CallVMMR0Ex(pVM->pVMR0, NIL_VMCPUID, VMMR0_DO_GMM_QUERY_STATISTICS, 0, &Req.Hdr); 1961 if (RT_SUCCESS(rc)) 1962 pUVM->stam.s.GMMStats = Req.Stats; 1963 } 1872 1964 } 1873 1965
Note:
See TracChangeset
for help on using the changeset viewer.