Changeset 85263 in vbox
- Timestamp:
- Jul 12, 2020 12:24:26 AM (4 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
-
include/Performance.h (modified) (8 diffs)
-
src-server/Performance.cpp (modified) (35 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/Performance.h
r82968 r85263 280 280 ULONG aBalloonedVMM, ULONG aSharedVMM, 281 281 ULONG aVmNetRx, ULONG aVmNetTx); 282 intenable(ULONG mask);283 intdisable(ULONG mask);284 285 intenqueueRequest(CollectorGuestRequest *aRequest);282 HRESULT enable(ULONG mask); 283 HRESULT disable(ULONG mask); 284 285 HRESULT enqueueRequest(CollectorGuestRequest *aRequest); 286 286 HRESULT enableInternal(ULONG mask); 287 intdisableInternal(ULONG mask);287 HRESULT disableInternal(ULONG mask); 288 288 289 289 const com::Utf8Str& getVMName() const { return mMachineName; }; … … 307 307 308 308 private: 309 intenableVMMStats(bool mCollectVMMStats);309 HRESULT enableVMMStats(bool mCollectVMMStats); 310 310 311 311 CollectorGuestManager *mManager; … … 347 347 void preCollect(CollectorHints& hints, uint64_t iTick); 348 348 void destroyUnregistered(); 349 intenqueueRequest(CollectorGuestRequest *aRequest);349 HRESULT enqueueRequest(CollectorGuestRequest *aRequest); 350 350 351 351 CollectorGuest *getBlockedGuest() { return mGuestBeingCalled; }; … … 418 418 bool collectorBeat(uint64_t nowAt); 419 419 420 virtual intenable() { mEnabled = true; return S_OK; };421 virtual intdisable() { mEnabled = false; return S_OK; };420 virtual HRESULT enable() { mEnabled = true; return S_OK; }; 421 virtual HRESULT disable() { mEnabled = false; return S_OK; }; 422 422 void unregister() { mUnregistered = true; }; 423 423 … … 649 649 void preCollect(CollectorHints& hints, uint64_t iTick); 650 650 void collect(); 651 intenable();652 intdisable();651 HRESULT enable(); 652 HRESULT disable(); 653 653 const char *getUnit() { return "kB"; }; 654 654 ULONG getMinValue() { return 0; }; … … 759 759 void preCollect(CollectorHints& hints, uint64_t iTick); 760 760 void collect(); 761 intenable();762 intdisable();761 HRESULT enable(); 762 HRESULT disable(); 763 763 const char *getUnit() { return "B/s"; }; 764 764 ULONG getMinValue() { return 0; }; … … 779 779 void preCollect(CollectorHints& hints, uint64_t iTick); 780 780 void collect(); 781 intenable();782 intdisable();781 HRESULT enable(); 782 HRESULT disable(); 783 783 const char *getUnit() { return "%"; }; 784 784 ULONG getMinValue() { return 0; }; … … 801 801 void preCollect(CollectorHints& hints, uint64_t iTick); 802 802 void collect(); 803 intenable();804 intdisable();803 HRESULT enable(); 804 HRESULT disable(); 805 805 const char *getUnit() { return "kB"; }; 806 806 ULONG getMinValue() { return 0; }; -
trunk/src/VBox/Main/src-server/Performance.cpp
r82968 r85263 114 114 RTCPUSET OnlineSet; 115 115 RTMpGetOnlineSet(&OnlineSet); 116 for ( RTCPUIDiCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++)116 for (int iCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++) 117 117 { 118 118 Log7Func(("{%p}: Checking if CPU %d is member of online set...\n", this, (int)iCpu)); … … 159 159 CollectorGuestRequest* CollectorGuestQueue::pop() 160 160 { 161 int rc = VINF_SUCCESS;162 CollectorGuestRequest *rq = NULL;161 int vrc = VINF_SUCCESS; 162 CollectorGuestRequest *rq = NULL; 163 163 164 164 do … … 176 176 if (rq) 177 177 return rq; 178 else 179 rc = RTSemEventWaitNoResume(mEvent, RT_INDEFINITE_WAIT); 180 } 181 while (RT_SUCCESS(rc)); 178 vrc = RTSemEventWaitNoResume(mEvent, RT_INDEFINITE_WAIT); 179 } while (RT_SUCCESS(vrc)); 182 180 183 181 return NULL; … … 243 241 } 244 242 245 intCollectorGuest::enableVMMStats(bool mCollectVMMStats)246 { 247 HRESULT ret= S_OK;243 HRESULT CollectorGuest::enableVMMStats(bool mCollectVMMStats) 244 { 245 HRESULT hrc = S_OK; 248 246 249 247 if (mGuest) … … 255 253 ComPtr<IInternalSessionControl> directControl; 256 254 257 ret= mMachine->i_getDirectControl(&directControl);258 if ( ret!= S_OK)259 return ret;255 hrc = mMachine->i_getDirectControl(&directControl); 256 if (hrc != S_OK) 257 return hrc; 260 258 261 259 /* enable statistics collection; this is a remote call (!) */ 262 ret= directControl->EnableVMMStatistics(mCollectVMMStats);260 hrc = directControl->EnableVMMStatistics(mCollectVMMStats); 263 261 Log7Func(("{%p}: %sable VMM stats (%s)\n", 264 this, mCollectVMMStats ? "En" : "Dis", SUCCEEDED(ret) ? "success" : "failed"));265 } 266 267 return ret;268 } 269 270 intCollectorGuest::enable(ULONG mask)262 this, mCollectVMMStats ? "En" : "Dis", SUCCEEDED(hrc) ? "success" : "failed")); 263 } 264 265 return hrc; 266 } 267 268 HRESULT CollectorGuest::enable(ULONG mask) 271 269 { 272 270 return enqueueRequest(new CGRQEnable(mask)); 273 271 } 274 272 275 intCollectorGuest::disable(ULONG mask)273 HRESULT CollectorGuest::disable(ULONG mask) 276 274 { 277 275 return enqueueRequest(new CGRQDisable(mask)); … … 324 322 } 325 323 326 intCollectorGuest::disableInternal(ULONG mask)324 HRESULT CollectorGuest::disableInternal(ULONG mask) 327 325 { 328 326 if (!(mEnabled & mask)) … … 345 343 } 346 344 347 intCollectorGuest::enqueueRequest(CollectorGuestRequest *aRequest)345 HRESULT CollectorGuest::enqueueRequest(CollectorGuestRequest *aRequest) 348 346 { 349 347 if (mManager) … … 399 397 : mVMMStatsProvider(NULL), mGuestBeingCalled(NULL) 400 398 { 401 int rc = RTThreadCreate(&mThread, CollectorGuestManager::requestProcessingThread,399 int vrc = RTThreadCreate(&mThread, CollectorGuestManager::requestProcessingThread, 402 400 this, 0, RTTHREADTYPE_MAIN_WORKER, RTTHREADFLAGS_WAITABLE, 403 401 "CGMgr"); 404 NOREF( rc);405 Log7Func(("{%p}: RTThreadCreate returned %Rrc (mThread=%p)\n", this, rc, mThread));402 NOREF(vrc); 403 Log7Func(("{%p}: RTThreadCreate returned %Rrc (mThread=%p)\n", this, vrc, mThread)); 406 404 } 407 405 … … 410 408 Assert(mGuests.size() == 0); 411 409 int rcThread = 0; 412 intrc = enqueueRequest(new CGRQAbort());413 if (SUCCEEDED( rc))410 HRESULT hrc = enqueueRequest(new CGRQAbort()); 411 if (SUCCEEDED(hrc)) 414 412 { 415 413 /* We wait only if we were able to put the abort request to a queue */ 416 414 Log7Func(("{%p}: Waiting for CGM request processing thread to stop...\n", this)); 417 rc = RTThreadWait(mThread, 1000 /* 1 sec */, &rcThread);418 Log7Func(("{%p}: RTThreadWait returned % u (thread exit code: %u)\n", this,rc, rcThread));415 int vrc = RTThreadWait(mThread, 1000 /* 1 sec */, &rcThread); 416 Log7Func(("{%p}: RTThreadWait returned %Rrc (thread exit code: %Rrc)\n", this, vrc, rcThread)); 419 417 } 420 418 } … … 435 433 void CollectorGuestManager::unregisterGuest(CollectorGuest* pGuest) 436 434 { 437 int rc = S_OK;438 439 435 Log7Func(("{%p}: About to unregister guest=%p provider=%p\n", this, pGuest, mVMMStatsProvider)); 440 436 //mGuests.remove(pGuest); => destroyUnregistered() … … 457 453 /* Found the guest already collecting stats, elect it */ 458 454 mVMMStatsProvider = *it; 459 rc = mVMMStatsProvider->enqueueRequest(new CGRQEnable(VMSTATS_VMM_RAM));460 if (FAILED( rc))455 HRESULT hrc = mVMMStatsProvider->enqueueRequest(new CGRQEnable(VMSTATS_VMM_RAM)); 456 if (FAILED(hrc)) 461 457 { 462 458 /* This is not a good candidate -- try to find another */ … … 478 474 mVMMStatsProvider = *it; 479 475 //mVMMStatsProvider->enable(VMSTATS_VMM_RAM); 480 rc = mVMMStatsProvider->enqueueRequest(new CGRQEnable(VMSTATS_VMM_RAM));481 if (SUCCEEDED( rc))476 HRESULT hrc = mVMMStatsProvider->enqueueRequest(new CGRQEnable(VMSTATS_VMM_RAM)); 477 if (SUCCEEDED(hrc)) 482 478 break; 483 479 /* This was not a good candidate -- try to find another */ … … 505 501 } 506 502 507 intCollectorGuestManager::enqueueRequest(CollectorGuestRequest *aRequest)503 HRESULT CollectorGuestManager::enqueueRequest(CollectorGuestRequest *aRequest) 508 504 { 509 505 #ifdef DEBUG … … 615 611 { 616 612 ULONG user, kernel, idle; 617 int rc = mHAL->getHostCpuLoad(&user, &kernel, &idle);618 if (RT_SUCCESS( rc))613 int vrc = mHAL->getHostCpuLoad(&user, &kernel, &idle); 614 if (RT_SUCCESS(vrc)) 619 615 { 620 616 mUser->put(user); … … 640 636 uint64_t userDiff, kernelDiff, idleDiff, totalDiff; 641 637 642 int rc = mHAL->getRawHostCpuLoad(&user, &kernel, &idle);643 if (RT_SUCCESS( rc))638 int vrc = mHAL->getRawHostCpuLoad(&user, &kernel, &idle); 639 if (RT_SUCCESS(vrc)) 644 640 { 645 641 userDiff = user - mUserPrev; … … 674 670 { 675 671 NETIFSTATUS enmState = NETIF_S_UNKNOWN; 676 int rc = NetIfGetState(szShortName, &enmState);677 if (RT_FAILURE( rc))672 int vrc = NetIfGetState(szShortName, &enmState); 673 if (RT_FAILURE(vrc)) 678 674 return false; 679 675 if (enmState != NETIF_S_UP) … … 681 677 else 682 678 { 683 rc = NetIfGetLinkSpeed(szShortName, pSpeed);684 if (RT_FAILURE( rc))679 vrc = NetIfGetLinkSpeed(szShortName, pSpeed); 680 if (RT_FAILURE(vrc)) 685 681 return false; 686 682 } … … 713 709 if (getLinkSpeed(mShortName.c_str(), &uSpeedMbit)) 714 710 mSpeed = (uint64_t)uSpeedMbit * (1000000/8); /* Convert to bytes/sec */ 715 /*int rc =*/ mHAL->getRawHostNetworkLoad(mShortName.c_str(), &mRxPrev, &mTxPrev);716 //AssertRC( rc);711 /*int vrc =*/ mHAL->getRawHostNetworkLoad(mShortName.c_str(), &mRxPrev, &mTxPrev); 712 //AssertRC(vrc); 717 713 } 718 714 … … 773 769 mLength = length; 774 770 mUtil->init(mLength); 775 int rc = mHAL->getRawHostDiskLoad(mDiskName.c_str(), &mDiskPrev, &mTotalPrev);776 AssertRC( rc);771 int vrc = mHAL->getRawHostDiskLoad(mDiskName.c_str(), &mDiskPrev, &mTotalPrev); 772 AssertRC(vrc); 777 773 } 778 774 … … 786 782 uint64_t disk, total; 787 783 788 int rc = mHAL->getRawHostDiskLoad(mDiskName.c_str(), &disk, &total);789 if (RT_SUCCESS( rc))784 int vrc = mHAL->getRawHostDiskLoad(mDiskName.c_str(), &disk, &total); 785 if (RT_SUCCESS(vrc)) 790 786 { 791 787 uint64_t diskDiff = disk - mDiskPrev; … … 828 824 } 829 825 else 830 LogFlowThisFunc(("Failed to collect data: %Rrc (%d)\n", rc,rc));826 LogFlowThisFunc(("Failed to collect data: %Rrc (%d)\n", vrc, vrc)); 831 827 } 832 828 … … 841 837 { 842 838 ULONG mhz; 843 int rc = mHAL->getHostCpuMHz(&mhz);844 if (RT_SUCCESS( rc))839 int vrc = mHAL->getHostCpuMHz(&mhz); 840 if (RT_SUCCESS(vrc)) 845 841 mMHz->put(mhz); 846 842 } … … 863 859 { 864 860 ULONG total, used, available; 865 int rc = mHAL->getHostMemoryUsage(&total, &used, &available);866 if (RT_SUCCESS( rc))861 int vrc = mHAL->getHostMemoryUsage(&total, &used, &available); 862 if (RT_SUCCESS(vrc)) 867 863 { 868 864 mTotal->put(total); … … 888 884 { 889 885 ULONG total, used, available; 890 int rc = mHAL->getHostFilesystemUsage(mFsName.c_str(), &total, &used, &available);891 if (RT_SUCCESS( rc))886 int vrc = mHAL->getHostFilesystemUsage(mFsName.c_str(), &total, &used, &available); 887 if (RT_SUCCESS(vrc)) 892 888 { 893 889 mTotal->put(total); … … 911 907 { 912 908 uint64_t total; 913 int rc = mHAL->getHostDiskSize(mDiskName.c_str(), &total);914 if (RT_SUCCESS( rc))909 int vrc = mHAL->getHostDiskSize(mDiskName.c_str(), &total); 910 if (RT_SUCCESS(vrc)) 915 911 mTotal->put((ULONG)(total / _1M)); 916 912 } 917 913 918 914 #ifndef VBOX_COLLECTOR_TEST_CASE 915 919 916 void HostRamVmm::init(ULONG period, ULONG length) 920 917 { … … 927 924 } 928 925 929 intHostRamVmm::enable()930 { 931 intrc = S_OK;926 HRESULT HostRamVmm::enable() 927 { 928 HRESULT hrc = S_OK; 932 929 CollectorGuest *provider = mCollectorGuestManager->getVMMStatsProvider(); 933 930 if (provider) 934 rc = provider->enable(VMSTATS_VMM_RAM);931 hrc = provider->enable(VMSTATS_VMM_RAM); 935 932 BaseMetric::enable(); 936 return rc;937 } 938 939 intHostRamVmm::disable()940 { 941 intrc = S_OK;933 return hrc; 934 } 935 936 HRESULT HostRamVmm::disable() 937 { 938 HRESULT rc = S_OK; 942 939 BaseMetric::disable(); 943 940 CollectorGuest *provider = mCollectorGuestManager->getVMMStatsProvider(); … … 988 985 mSharedVMM->put(mSharedCurrent); 989 986 } 987 990 988 #endif /* !VBOX_COLLECTOR_TEST_CASE */ 991 989 … … 1003 1001 { 1004 1002 ULONG user, kernel; 1005 int rc = mHAL->getProcessCpuLoad(mProcess, &user, &kernel);1006 if (RT_SUCCESS( rc))1003 int vrc = mHAL->getProcessCpuLoad(mProcess, &user, &kernel); 1004 if (RT_SUCCESS(vrc)) 1007 1005 { 1008 1006 mUser->put(user); … … 1020 1018 uint64_t processUser, processKernel, hostTotal; 1021 1019 1022 int rc = mHAL->getRawProcessCpuLoad(mProcess, &processUser, &processKernel, &hostTotal);1023 if (RT_SUCCESS( rc))1020 int vrc = mHAL->getRawProcessCpuLoad(mProcess, &processUser, &processKernel, &hostTotal); 1021 if (RT_SUCCESS(vrc)) 1024 1022 { 1025 1023 if (hostTotal == mHostTotalPrev) … … 1056 1054 { 1057 1055 ULONG used; 1058 int rc = mHAL->getProcessMemoryUsage(mProcess, &used);1059 if (RT_SUCCESS( rc))1056 int vrc = mHAL->getProcessMemoryUsage(mProcess, &used); 1057 if (RT_SUCCESS(vrc)) 1060 1058 mUsed->put(used); 1061 1059 } … … 1063 1061 1064 1062 #ifndef VBOX_COLLECTOR_TEST_CASE 1063 1065 1064 void MachineDiskUsage::init(ULONG period, ULONG length) 1066 1065 { … … 1115 1114 } 1116 1115 1117 intMachineNetRate::enable()1118 { 1119 intrc = mCGuest->enable(VMSTATS_NET_RATE);1116 HRESULT MachineNetRate::enable() 1117 { 1118 HRESULT rc = mCGuest->enable(VMSTATS_NET_RATE); 1120 1119 BaseMetric::enable(); 1121 1120 return rc; 1122 1121 } 1123 1122 1124 intMachineNetRate::disable()1123 HRESULT MachineNetRate::disable() 1125 1124 { 1126 1125 BaseMetric::disable(); … … 1159 1158 } 1160 1159 1161 intGuestCpuLoad::enable()1162 { 1163 intrc = mCGuest->enable(VMSTATS_GUEST_CPULOAD);1160 HRESULT GuestCpuLoad::enable() 1161 { 1162 HRESULT rc = mCGuest->enable(VMSTATS_GUEST_CPULOAD); 1164 1163 BaseMetric::enable(); 1165 1164 return rc; 1166 1165 } 1167 1166 1168 intGuestCpuLoad::disable()1167 HRESULT GuestCpuLoad::disable() 1169 1168 { 1170 1169 BaseMetric::disable(); … … 1199 1198 } 1200 1199 1201 intGuestRamUsage::enable()1202 { 1203 intrc = mCGuest->enable(VMSTATS_GUEST_RAMUSAGE);1200 HRESULT GuestRamUsage::enable() 1201 { 1202 HRESULT rc = mCGuest->enable(VMSTATS_GUEST_RAMUSAGE); 1204 1203 BaseMetric::enable(); 1205 1204 return rc; 1206 1205 } 1207 1206 1208 intGuestRamUsage::disable()1207 HRESULT GuestRamUsage::disable() 1209 1208 { 1210 1209 BaseMetric::disable(); … … 1216 1215 hints.collectGuestStats(mCGuest->getProcess()); 1217 1216 } 1217 1218 1218 #endif /* !VBOX_COLLECTOR_TEST_CASE */ 1219 1219
Note:
See TracChangeset
for help on using the changeset viewer.

