Changeset 29620 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 18, 2010 12:15:55 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/GMM.cpp
r29613 r29620 290 290 * @see GMMR0QueryVMMMemoryStatsReq 291 291 */ 292 GMMR3DECL(int) GMMR3QueryHypervisorMemoryStats(PVM pVM, uint64_t *pcTotalAllocPages, uint64_t *pcTotalFreePages, uint64_t *pcTotalBalloonPages )292 GMMR3DECL(int) GMMR3QueryHypervisorMemoryStats(PVM pVM, uint64_t *pcTotalAllocPages, uint64_t *pcTotalFreePages, uint64_t *pcTotalBalloonPages, uint64_t *puTotalBalloonSize) 293 293 { 294 294 GMMMEMSTATSREQ Req; … … 298 298 Req.cFreePages = 0; 299 299 Req.cBalloonedPages = 0; 300 Req.cSharedPages = 0; 300 301 301 302 *pcTotalAllocPages = 0; 302 303 *pcTotalFreePages = 0; 303 304 *pcTotalBalloonPages = 0; 305 *puTotalBalloonSize = 0; 304 306 305 307 /* Must be callable from any thread, so can't use VMMR3CallR0. */ … … 310 312 *pcTotalFreePages = Req.cFreePages; 311 313 *pcTotalBalloonPages = Req.cBalloonedPages; 314 *puTotalBalloonSize = Req.cSharedPages; 312 315 } 313 316 return rc; -
trunk/src/VBox/VMM/PGMPhys.cpp
r29577 r29620 967 967 * @param puTotalFreeSize Pointer to total free (allocated but not used yet) memory inside VMMR0 (in bytes) 968 968 * @param puTotalBalloonSize Pointer to total ballooned memory inside VMMR0 (in bytes) 969 */ 970 VMMR3DECL(int) PGMR3QueryVMMMemoryStats(PVM pVM, uint64_t *puTotalAllocSize, uint64_t *puTotalFreeSize, uint64_t *puTotalBalloonSize) 969 * @param puTotalSharedSize Pointer to total shared memory inside VMMR0 (in bytes) 970 */ 971 VMMR3DECL(int) PGMR3QueryVMMMemoryStats(PVM pVM, uint64_t *puTotalAllocSize, uint64_t *puTotalFreeSize, uint64_t *puTotalBalloonSize, uint64_t *puTotalSharedSize) 971 972 { 972 973 int rc; 973 974 974 uint64_t cAllocPages = 0, cFreePages = 0, cBalloonPages = 0 ;975 rc = GMMR3QueryHypervisorMemoryStats(pVM, &cAllocPages, &cFreePages, &cBalloonPages );975 uint64_t cAllocPages = 0, cFreePages = 0, cBalloonPages = 0, cSharedPages = 0; 976 rc = GMMR3QueryHypervisorMemoryStats(pVM, &cAllocPages, &cFreePages, &cBalloonPages, &cSharedPages); 976 977 AssertRCReturn(rc, rc); 977 978 … … 984 985 if (puTotalBalloonSize) 985 986 *puTotalBalloonSize = cBalloonPages * _4K; 987 988 if (puTotalSharedSize) 989 *puTotalSharedSize = cSharedPages * _4K; 990 991 return VINF_SUCCESS; 992 } 993 994 /** 995 * Query memory stats for the VM 996 * 997 * @returns VBox status code. 998 * @param pVM The VM handle. 999 * @param puTotalAllocSize Pointer to total allocated memory inside the VM (in bytes) 1000 * @param puTotalFreeSize Pointer to total free (allocated but not used yet) memory inside the VM (in bytes) 1001 * @param puTotalBalloonSize Pointer to total ballooned memory inside the VM (in bytes) 1002 * @param puTotalSharedSize Pointer to total shared memory inside the VM (in bytes) 1003 */ 1004 VMMR3DECL(int) PGMR3QueryMemoryStats(PVM pVM, uint64_t *pulTotalMem, uint64_t *pulPrivateMem, uint64_t *puTotalSharedMem, uint64_t *puTotalZeroMem) 1005 { 1006 if (pulTotalMem) 1007 *pulTotalMem = pVM->pgm.s.cAllPages * _4K; 1008 1009 if (pulPrivateMem) 1010 *pulPrivateMem = pVM->pgm.s.cPrivatePages * _4K; 1011 1012 if (puTotalSharedMem) 1013 *puTotalSharedMem = pVM->pgm.s.cReusedSharedPages * _4K; 1014 1015 if (puTotalZeroMem) 1016 *puTotalZeroMem = pVM->pgm.s.cZeroPages * _4K; 986 1017 987 1018 return VINF_SUCCESS; -
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r29613 r29620 505 505 /** The number of pages that are shared. A subset of cAllocatedPages. */ 506 506 uint64_t cSharedPages; 507 /** The number of pages that are actually shared between VMs. */ 508 uint64_t cDuplicatePages; 507 509 /** The number of pages that are shared that has been left behind by 508 510 * VMs not doing proper cleanups. */ … … 852 854 pGMM->cAllocatedPages = 0; 853 855 pGMM->cSharedPages = 0; 856 pGMM->cDuplicatePages = 0; 854 857 pGMM->cLeftBehindSharedPages = 0; 855 858 pGMM->cChunks = 0; … … 2127 2130 pGVM->gmm.s.Allocated.cBasePages--; 2128 2131 if (!--pPage->Shared.cRefs) 2132 { 2129 2133 gmmR0FreeSharedPage(pGMM, paPages[iPage].idSharedPage, pPage); 2134 } 2135 else 2136 { 2137 Assert(pGMM->cDuplicatePages); 2138 pGMM->cDuplicatePages--; 2139 } 2130 2140 2131 2141 paPages[iPage].idSharedPage = NIL_GMM_PAGEID; … … 2667 2677 Assert(pGMM->cSharedPages > 0); 2668 2678 Assert(pGMM->cAllocatedPages > 0); 2679 2680 pGMM->cDuplicatePages++; 2669 2681 2670 2682 pPage->Shared.cRefs++; … … 3078 3090 pReq->cBalloonedPages = pGMM->cBalloonedPages; 3079 3091 pReq->cMaxPages = pGMM->cMaxPages; 3092 pReq->cSharedPages = pGMM->cDuplicatePages; 3080 3093 GMM_CHECK_SANITY_UPON_LEAVING(pGMM); 3081 3094
Note:
See TracChangeset
for help on using the changeset viewer.