Changeset 44347 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jan 24, 2013 12:27:56 AM (12 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/DisplayImpl.h
r42878 r44347 122 122 HRESULT init (Console *aParent); 123 123 void uninit(); 124 int registerSSM(P VM pVM);124 int registerSSM(PUVM pUVM); 125 125 126 126 // public methods only for internal purposes -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r44340 r44347 8900 8900 * Register our load/save state file handlers 8901 8901 */ 8902 vrc = SSMR3RegisterExternal(p VM, sSSMConsoleUnit, 0 /*iInstance*/, sSSMConsoleVer, 0 /* cbGuess */,8902 vrc = SSMR3RegisterExternal(pConsole->mpUVM, sSSMConsoleUnit, 0 /*iInstance*/, sSSMConsoleVer, 0 /* cbGuess */, 8903 8903 NULL, NULL, NULL, 8904 8904 NULL, saveStateFileExec, NULL, … … 8907 8907 AssertRCBreak(vrc); 8908 8908 8909 vrc = static_cast<Console *>(pConsole)->getDisplay()->registerSSM(p VM);8909 vrc = static_cast<Console *>(pConsole)->getDisplay()->registerSSM(pConsole->mpUVM); 8910 8910 AssertRC(vrc); 8911 8911 if (RT_FAILURE(vrc)) … … 9282 9282 { 9283 9283 PUVM pUVM = (PUVM)pvUser; 9284 SSMR3Cancel( VMR3GetVM(pUVM));9284 SSMR3Cancel(pUVM); 9285 9285 } 9286 9286 -
trunk/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
r44340 r44347 574 574 { 575 575 TeleporterState *pState = (TeleporterState *)pvUser; 576 SSMR3Cancel( VMR3GetVM(pState->mpUVM));576 SSMR3Cancel(pState->mpUVM); 577 577 if (!pState->mfIsSource) 578 578 { … … 598 598 if (SUCCEEDED(hrc) && fCanceled) 599 599 { 600 SSMR3Cancel( VMR3GetVM(pState->mpUVM));600 SSMR3Cancel(pState->mpUVM); 601 601 return VERR_SSM_CANCELLED; 602 602 } -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r44340 r44347 569 569 * pass pVM 570 570 */ 571 int Display::registerSSM(P VM pVM)571 int Display::registerSSM(PUVM pUVM) 572 572 { 573 573 /* Version 2 adds width and height of the framebuffer; version 3 adds 574 574 * the framebuffer offset in the virtual desktop and the framebuffer flags. 575 575 */ 576 int rc = SSMR3RegisterExternal(p VM, "DisplayData", 0, sSSMDisplayVer3,576 int rc = SSMR3RegisterExternal(pUVM, "DisplayData", 0, sSSMDisplayVer3, 577 577 mcMonitors * sizeof(uint32_t) * 8 + sizeof(uint32_t), 578 578 NULL, NULL, NULL, … … 585 585 * 3 * sizeof(uint32_t *) due to a code mistake. 586 586 */ 587 rc = SSMR3RegisterExternal(p VM, "DisplayData", 12 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/,587 rc = SSMR3RegisterExternal(pUVM, "DisplayData", 12 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/, 588 588 NULL, NULL, NULL, 589 589 NULL, NULL, NULL, … … 591 591 AssertRCReturn(rc, rc); 592 592 593 rc = SSMR3RegisterExternal(p VM, "DisplayData", 24 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/,593 rc = SSMR3RegisterExternal(pUVM, "DisplayData", 24 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/, 594 594 NULL, NULL, NULL, 595 595 NULL, NULL, NULL, … … 598 598 599 599 /* uInstance is an arbitrary value greater than 1024. Such a value will ensure a quick seek in saved state file. */ 600 rc = SSMR3RegisterExternal(p VM, "DisplayScreenshot", 1100 /*uInstance*/, sSSMDisplayScreenshotVer, 0 /*cbGuess*/,600 rc = SSMR3RegisterExternal(pUVM, "DisplayScreenshot", 1100 /*uInstance*/, sSSMDisplayScreenshotVer, 0 /*cbGuess*/, 601 601 NULL, NULL, NULL, 602 602 NULL, displaySSMSaveScreenshot, NULL, -
trunk/src/VBox/Main/src-client/GuestImpl.cpp
r43908 r44347 231 231 void Guest::updateStats(uint64_t iTick) 232 232 { 233 uint64_t uFreeTotal, uAllocTotal, uBalloonedTotal, uSharedTotal; 234 uint64_t uTotalMem, uPrivateMem, uSharedMem, uZeroMem; 233 uint64_t cbFreeTotal = 0; 234 uint64_t cbAllocTotal = 0; 235 uint64_t cbBalloonedTotal = 0; 236 uint64_t cbSharedTotal = 0; 237 uint64_t cbSharedMem = 0; 238 ULONG uNetStatRx = 0; 239 ULONG uNetStatTx = 0; 240 ULONG aGuestStats[GUESTSTATTYPE_MAX]; 241 RT_ZERO(aGuestStats); 235 242 236 243 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 237 244 238 ULONG uNetStatRx = 0;239 ULONG uNetStatTx = 0;240 ULONG aGuestStats[GUESTSTATTYPE_MAX];241 RT_ZERO(aGuestStats);242 245 ULONG validStats = mVmValidStats; 243 246 /* Check if we have anything to report */ … … 248 251 } 249 252 alock.release(); 253 250 254 /* 251 255 * Calling SessionMachine may take time as the object resides in VBoxSVC … … 253 257 * and released the lock. 254 258 */ 255 uFreeTotal = 0; 256 uAllocTotal = 0; 257 uBalloonedTotal = 0; 258 uSharedTotal = 0; 259 uTotalMem = 0; 260 uPrivateMem = 0; 261 uSharedMem = 0; 262 uZeroMem = 0; 263 264 Console::SafeVMPtr pVM(mParent); 265 if (pVM.isOk()) 259 Console::SafeVMPtr ptrVM(mParent); 260 if (ptrVM.isOk()) 266 261 { 267 262 int rc; … … 274 269 { 275 270 /* Query the missing per-VM memory statistics. */ 276 rc = PGMR3QueryMemoryStats(pVM.raw(), &uTotalMem, &uPrivateMem, &uSharedMem, &uZeroMem); 271 uint64_t cbTotalMemIgn, cbPrivateMemIgn, cbZeroMemIgn; 272 rc = PGMR3QueryMemoryStats(ptrVM.rawUVM(), &cbTotalMemIgn, &cbPrivateMemIgn, &cbSharedMem, &cbZeroMemIgn); 277 273 if (rc == VINF_SUCCESS) 278 274 { … … 283 279 if (mCollectVMMStats) 284 280 { 285 rc = PGMR3QueryGlobalMemoryStats(p VM.raw(), &uAllocTotal, &uFreeTotal, &uBalloonedTotal, &uSharedTotal);281 rc = PGMR3QueryGlobalMemoryStats(ptrVM.rawUVM(), &cbAllocTotal, &cbFreeTotal, &cbBalloonedTotal, &cbSharedTotal); 286 282 AssertRC(rc); 287 283 if (rc == VINF_SUCCESS) … … 296 292 uint64_t uTxPrev = mNetStatTx; 297 293 mNetStatRx = mNetStatTx = 0; 298 rc = STAMR3Enum(p VM, "*/ReceiveBytes|*/TransmitBytes", staticEnumStatsCallback, this);294 rc = STAMR3Enum(ptrVM.rawUVM(), "*/ReceiveBytes|*/TransmitBytes", staticEnumStatsCallback, this); 299 295 uint64_t uTsNow = RTTimeNanoTS(); 300 296 uint64_t uTimePassed = uTsNow - mNetStatLastTs; … … 315 311 mCurrentGuestStat[GUESTSTATTYPE_MEMFREE] * (_4K/_1K), 316 312 mCurrentGuestStat[GUESTSTATTYPE_MEMBALLOON] * (_4K/_1K), 317 (ULONG)( uSharedMem / _1K), /* bytes -> KB */313 (ULONG)(cbSharedMem / _1K), /* bytes -> KB */ 318 314 mCurrentGuestStat[GUESTSTATTYPE_MEMCACHE] * (_4K/_1K), 319 315 mCurrentGuestStat[GUESTSTATTYPE_PAGETOTAL] * (_4K/_1K), 320 (ULONG)( uAllocTotal / _1K), /* bytes -> KB */321 (ULONG)( uFreeTotal / _1K),322 (ULONG)( uBalloonedTotal / _1K),323 (ULONG)( uSharedTotal / _1K),316 (ULONG)(cbAllocTotal / _1K), /* bytes -> KB */ 317 (ULONG)(cbFreeTotal / _1K), 318 (ULONG)(cbBalloonedTotal / _1K), 319 (ULONG)(cbSharedTotal / _1K), 324 320 uNetStatRx, 325 321 uNetStatTx); … … 637 633 *aPageTotal = mCurrentGuestStat[GUESTSTATTYPE_PAGETOTAL] * (_4K/_1K); /* page (4K) -> 1KB units */ 638 634 635 /* Play safe or smth? */ 636 *aMemAllocTotal = 0; 637 *aMemFreeTotal = 0; 638 *aMemBalloonTotal = 0; 639 *aMemSharedTotal = 0; 640 *aMemShared = 0; 641 639 642 /* MUST release all locks before calling any PGM statistics queries, 640 643 * as they are executed by EMT and that might deadlock us by VMM device 641 644 * activity which waits for the Guest object lock. */ 642 645 alock.release(); 643 Console::SafeVMPtr pVM (mParent); 644 if (pVM.isOk()) 645 { 646 uint64_t uFreeTotal, uAllocTotal, uBalloonedTotal, uSharedTotal; 647 *aMemFreeTotal = 0; 648 int rc = PGMR3QueryGlobalMemoryStats(pVM.raw(), &uAllocTotal, &uFreeTotal, &uBalloonedTotal, &uSharedTotal); 649 AssertRC(rc); 650 if (rc == VINF_SUCCESS) 651 { 652 *aMemAllocTotal = (ULONG)(uAllocTotal / _1K); /* bytes -> KB */ 653 *aMemFreeTotal = (ULONG)(uFreeTotal / _1K); 654 *aMemBalloonTotal = (ULONG)(uBalloonedTotal / _1K); 655 *aMemSharedTotal = (ULONG)(uSharedTotal / _1K); 656 } 657 else 658 return E_FAIL; 659 660 /* Query the missing per-VM memory statistics. */ 661 *aMemShared = 0; 662 uint64_t uTotalMem, uPrivateMem, uSharedMem, uZeroMem; 663 rc = PGMR3QueryMemoryStats(pVM.raw(), &uTotalMem, &uPrivateMem, &uSharedMem, &uZeroMem); 664 if (rc == VINF_SUCCESS) 665 { 666 *aMemShared = (ULONG)(uSharedMem / _1K); 667 } 668 else 669 return E_FAIL; 670 } 671 else 672 { 673 *aMemAllocTotal = 0; 674 *aMemFreeTotal = 0; 675 *aMemBalloonTotal = 0; 676 *aMemSharedTotal = 0; 677 *aMemShared = 0; 646 Console::SafeVMPtr ptrVM(mParent); 647 if (!ptrVM.isOk()) 678 648 return E_FAIL; 679 } 649 650 uint64_t cbFreeTotal, cbAllocTotal, cbBalloonedTotal, cbSharedTotal; 651 int rc = PGMR3QueryGlobalMemoryStats(ptrVM.rawUVM(), &cbAllocTotal, &cbFreeTotal, &cbBalloonedTotal, &cbSharedTotal); 652 AssertRCReturn(rc, E_FAIL); 653 654 *aMemAllocTotal = (ULONG)(cbAllocTotal / _1K); /* bytes -> KB */ 655 *aMemFreeTotal = (ULONG)(cbFreeTotal / _1K); 656 *aMemBalloonTotal = (ULONG)(cbBalloonedTotal / _1K); 657 *aMemSharedTotal = (ULONG)(cbSharedTotal / _1K); 658 659 /* Query the missing per-VM memory statistics. */ 660 uint64_t cbTotalMemIgn, cbPrivateMemIgn, cbSharedMem, cbZeroMemIgn; 661 rc = PGMR3QueryMemoryStats(ptrVM.rawUVM(), &cbTotalMemIgn, &cbPrivateMemIgn, &cbSharedMem, &cbZeroMemIgn); 662 AssertRCReturn(rc, E_FAIL); 663 *aMemShared = (ULONG)(cbSharedMem / _1K); 680 664 681 665 return S_OK; -
trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
r44346 r44347 754 754 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 755 755 756 Console::SafeVMPtrQuiet pVM (mParent); 757 758 if (pVM.isOk()) 759 { 760 uint64_t cr4 = CPUMGetGuestCR4 (VMMGetCpu0(pVM.raw())); 761 *aEnabled = !!(cr4 & X86_CR4_PAE); 756 Console::SafeVMPtrQuiet ptrVM(mParent); 757 758 if (ptrVM.isOk()) 759 { 760 uint32_t cr4; 761 int rc = DBGFR3RegCpuQueryU32(ptrVM.raw(), 0 /*idCpu*/, DBGFREG_CR4, &cr4); AssertRC(rc); 762 *aEnabled = RT_BOOL(cr4 & X86_CR4_PAE); 762 763 } 763 764 else … … 1409 1410 STDMETHODIMP MachineDebugger::ResetStats(IN_BSTR aPattern) 1410 1411 { 1411 Console::SafeVMPtrQuiet p VM(mParent);1412 1413 if (!p VM.isOk())1412 Console::SafeVMPtrQuiet ptrVM(mParent); 1413 1414 if (!ptrVM.isOk()) 1414 1415 return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running"); 1415 1416 1416 STAMR3Reset(p VM, Utf8Str(aPattern).c_str());1417 STAMR3Reset(ptrVM.rawUVM(), Utf8Str(aPattern).c_str()); 1417 1418 1418 1419 return S_OK; … … 1425 1426 * @param aPattern The selection pattern. A bit similar to filename globbing. 1426 1427 */ 1427 STDMETHODIMP MachineDebugger::DumpStats 1428 { 1429 Console::SafeVMPtrQuiet p VM(mParent);1430 1431 if (!p VM.isOk())1428 STDMETHODIMP MachineDebugger::DumpStats(IN_BSTR aPattern) 1429 { 1430 Console::SafeVMPtrQuiet ptrVM(mParent); 1431 1432 if (!ptrVM.isOk()) 1432 1433 return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running"); 1433 1434 1434 STAMR3Dump(p VM, Utf8Str(aPattern).c_str());1435 STAMR3Dump(ptrVM.rawUVM(), Utf8Str(aPattern).c_str()); 1435 1436 1436 1437 return S_OK; … … 1447 1448 STDMETHODIMP MachineDebugger::GetStats (IN_BSTR aPattern, BOOL aWithDescriptions, BSTR *aStats) 1448 1449 { 1449 Console::SafeVMPtrQuiet p VM (mParent);1450 1451 if (!p VM.isOk())1450 Console::SafeVMPtrQuiet ptrVM (mParent); 1451 1452 if (!ptrVM.isOk()) 1452 1453 return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running"); 1453 1454 1454 1455 char *pszSnapshot; 1455 int vrc = STAMR3Snapshot(p VM, Utf8Str(aPattern).c_str(), &pszSnapshot, NULL,1456 int vrc = STAMR3Snapshot(ptrVM.rawUVM(), Utf8Str(aPattern).c_str(), &pszSnapshot, NULL, 1456 1457 !!aWithDescriptions); 1457 1458 if (RT_FAILURE(vrc)) … … 1463 1464 * of the amount statistics in a debug build. */ 1464 1465 Bstr(pszSnapshot).detachTo(aStats); 1466 STAMR3SnapshotFree(ptrVM.rawUVM(), pszSnapshot); 1465 1467 1466 1468 return S_OK;
Note:
See TracChangeset
for help on using the changeset viewer.