Changeset 43908 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Nov 19, 2012 5:36:43 AM (12 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r43900 r43908 11512 11512 pm::SubMetric *ramUsageUsed = new pm::SubMetric("RAM/Usage/Used", 11513 11513 "Size of resident portion of VM process in memory."); 11514 pm::SubMetric *machineNetRx = new pm::SubMetric("Net/Rate/Rx", 11515 "Network receive rate."); 11516 pm::SubMetric *machineNetTx = new pm::SubMetric("Net/Rate/Tx", 11517 "Network transmit rate."); 11514 11518 /* Create and register base metrics */ 11515 11519 pm::BaseMetric *cpuLoad = new pm::MachineCpuLoadRaw(hal, aMachine, pid, … … 11568 11572 11569 11573 /* Create and register base metrics */ 11574 pm::BaseMetric *machineNetRate = new pm::MachineNetRate(mCollectorGuest, aMachine, 11575 machineNetRx, machineNetTx); 11576 aCollector->registerBaseMetric(machineNetRate); 11577 11570 11578 pm::BaseMetric *guestCpuLoad = new pm::GuestCpuLoad(mCollectorGuest, aMachine, 11571 11579 guestLoadUser, guestLoadKernel, guestLoadIdle); … … 11577 11585 guestMemCache, guestPagedTotal); 11578 11586 aCollector->registerBaseMetric(guestCpuMem); 11587 11588 aCollector->registerMetric(new pm::Metric(machineNetRate, machineNetRx, 0)); 11589 aCollector->registerMetric(new pm::Metric(machineNetRate, machineNetRx, new pm::AggregateAvg())); 11590 aCollector->registerMetric(new pm::Metric(machineNetRate, machineNetRx, new pm::AggregateMin())); 11591 aCollector->registerMetric(new pm::Metric(machineNetRate, machineNetRx, new pm::AggregateMax())); 11592 11593 aCollector->registerMetric(new pm::Metric(machineNetRate, machineNetTx, 0)); 11594 aCollector->registerMetric(new pm::Metric(machineNetRate, machineNetTx, new pm::AggregateAvg())); 11595 aCollector->registerMetric(new pm::Metric(machineNetRate, machineNetTx, new pm::AggregateMin())); 11596 aCollector->registerMetric(new pm::Metric(machineNetRate, machineNetTx, new pm::AggregateMax())); 11579 11597 11580 11598 aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadUser, 0)); … … 12149 12167 * Passes collected guest statistics to performance collector object 12150 12168 */ 12151 STDMETHODIMP SessionMachine::ReportGuestStatistics(ULONG aValidStats, ULONG aCpuUser, 12152 ULONG aCpuKernel, ULONG aCpuIdle, 12153 ULONG aMemTotal, ULONG aMemFree, 12154 ULONG aMemBalloon, ULONG aMemShared, 12155 ULONG aMemCache, ULONG aPageTotal, 12156 ULONG aAllocVMM, ULONG aFreeVMM, 12157 ULONG aBalloonedVMM, ULONG aSharedVMM) 12169 STDMETHODIMP SessionMachine::ReportVmStatistics(ULONG aValidStats, ULONG aCpuUser, 12170 ULONG aCpuKernel, ULONG aCpuIdle, 12171 ULONG aMemTotal, ULONG aMemFree, 12172 ULONG aMemBalloon, ULONG aMemShared, 12173 ULONG aMemCache, ULONG aPageTotal, 12174 ULONG aAllocVMM, ULONG aFreeVMM, 12175 ULONG aBalloonedVMM, ULONG aSharedVMM, 12176 ULONG aVmNetRx, ULONG aVmNetTx) 12158 12177 { 12159 12178 if (mCollectorGuest) … … 12161 12180 aMemTotal, aMemFree, aMemBalloon, aMemShared, 12162 12181 aMemCache, aPageTotal, aAllocVMM, aFreeVMM, 12163 aBalloonedVMM, aSharedVMM );12182 aBalloonedVMM, aSharedVMM, aVmNetRx, aVmNetTx); 12164 12183 12165 12184 return S_OK; -
trunk/src/VBox/Main/src-server/Performance.cpp
r43831 r43908 223 223 mCpuUser(0), mCpuKernel(0), mCpuIdle(0), 224 224 mMemTotal(0), mMemFree(0), mMemBalloon(0), mMemShared(0), mMemCache(0), mPageTotal(0), 225 mAllocVMM(0), mFreeVMM(0), mBalloonedVMM(0), mSharedVMM(0) 225 mAllocVMM(0), mFreeVMM(0), mBalloonedVMM(0), mSharedVMM(0), mVmNetRx(0), mVmNetTx(0) 226 226 { 227 227 Assert(mMachine); … … 312 312 } 313 313 } 314 if ((mask & GUESTSTATS_VMMRAM) == GUESTSTATS_VMMRAM)314 if ((mask & VMSTATS_VMM_RAM) == VMSTATS_VMM_RAM) 315 315 enableVMMStats(true); 316 316 mEnabled |= mask; … … 324 324 return E_UNEXPECTED; 325 325 326 if ((mask & GUESTSTATS_VMMRAM) == GUESTSTATS_VMMRAM)326 if ((mask & VMSTATS_VMM_RAM) == VMSTATS_VMM_RAM) 327 327 enableVMMStats(false); 328 328 mEnabled &= ~mask; … … 334 334 LogAleksey(("{%p} " LOG_FN_FMT ": Set guest statistics update interval to 0 sec (%s)\n", 335 335 this, __PRETTY_FUNCTION__, SUCCEEDED(ret)?"success":"failed")); 336 invalidate( GUESTSTATS_ALL);336 invalidate(VMSTATS_ALL); 337 337 } 338 338 … … 359 359 ULONG aMemCache, ULONG aPageTotal, 360 360 ULONG aAllocVMM, ULONG aFreeVMM, 361 ULONG aBalloonedVMM, ULONG aSharedVMM) 362 { 363 if ((aValidStats & GUESTSTATS_CPULOAD) == GUESTSTATS_CPULOAD) 361 ULONG aBalloonedVMM, ULONG aSharedVMM, 362 ULONG aVmNetRx, ULONG aVmNetTx) 363 { 364 if ((aValidStats & VMSTATS_GUEST_CPULOAD) == VMSTATS_GUEST_CPULOAD) 364 365 { 365 366 mCpuUser = aCpuUser; … … 367 368 mCpuIdle = aCpuIdle; 368 369 } 369 if ((aValidStats & GUESTSTATS_RAMUSAGE) == GUESTSTATS_RAMUSAGE)370 if ((aValidStats & VMSTATS_GUEST_RAMUSAGE) == VMSTATS_GUEST_RAMUSAGE) 370 371 { 371 372 mMemTotal = aMemTotal; … … 376 377 mPageTotal = aPageTotal; 377 378 } 378 if ((aValidStats & GUESTSTATS_VMMRAM) == GUESTSTATS_VMMRAM)379 if ((aValidStats & VMSTATS_VMM_RAM) == VMSTATS_VMM_RAM) 379 380 { 380 381 mAllocVMM = aAllocVMM; … … 382 383 mBalloonedVMM = aBalloonedVMM; 383 384 mSharedVMM = aSharedVMM; 385 } 386 if ((aValidStats & VMSTATS_NET_RATE) == VMSTATS_NET_RATE) 387 { 388 mVmNetRx = aVmNetRx; 389 mVmNetTx = aVmNetTx; 384 390 } 385 391 mValid = aValidStats; … … 452 458 /* Found the guest already collecting stats, elect it */ 453 459 mVMMStatsProvider = *it; 454 rc = mVMMStatsProvider->enqueueRequest(new CGRQEnable( GUESTSTATS_VMMRAM));460 rc = mVMMStatsProvider->enqueueRequest(new CGRQEnable(VMSTATS_VMM_RAM)); 455 461 if (FAILED(rc)) 456 462 { … … 472 478 473 479 mVMMStatsProvider = *it; 474 //mVMMStatsProvider->enable( GUESTSTATS_VMMRAM);475 rc = mVMMStatsProvider->enqueueRequest(new CGRQEnable( GUESTSTATS_VMMRAM));480 //mVMMStatsProvider->enable(VMSTATS_VMM_RAM); 481 rc = mVMMStatsProvider->enqueueRequest(new CGRQEnable(VMSTATS_VMM_RAM)); 476 482 if (SUCCEEDED(rc)) 477 483 break; … … 671 677 mRx->init(mLength); 672 678 mTx->init(mLength); 673 int rc =mHAL->getRawHostNetworkLoad(mShortName.c_str(), &mRxPrev, &mTxPrev);679 /*int rc =*/ mHAL->getRawHostNetworkLoad(mShortName.c_str(), &mRxPrev, &mTxPrev); 674 680 //AssertRC(rc); 675 681 } … … 867 873 CollectorGuest *provider = mCollectorGuestManager->getVMMStatsProvider(); 868 874 if (provider) 869 rc = provider->enable( GUESTSTATS_VMMRAM);875 rc = provider->enable(VMSTATS_VMM_RAM); 870 876 BaseMetric::enable(); 871 877 return rc; … … 878 884 CollectorGuest *provider = mCollectorGuestManager->getVMMStatsProvider(); 879 885 if (provider) 880 rc = provider->disable( GUESTSTATS_VMMRAM);886 rc = provider->disable(VMSTATS_VMM_RAM); 881 887 return rc; 882 888 } … … 894 900 LogAleksey(("{%p} " LOG_FN_FMT ": provider=%p enabled=%s valid=%s...\n", 895 901 this, __PRETTY_FUNCTION__, provider, provider->isEnabled()?"y":"n", 896 provider->isValid( GUESTSTATS_VMMRAM)?"y":"n"));897 if (provider->isValid( GUESTSTATS_VMMRAM))902 provider->isValid(VMSTATS_VMM_RAM)?"y":"n")); 903 if (provider->isValid(VMSTATS_VMM_RAM)) 898 904 { 899 905 /* Provider is ready, get updated stats */ … … 902 908 mBalloonedCurrent = provider->getBalloonedVMM(); 903 909 mSharedCurrent = provider->getSharedVMM(); 904 provider->invalidate( GUESTSTATS_VMMRAM);910 provider->invalidate(VMSTATS_VMM_RAM); 905 911 } 906 912 /* … … 1000 1006 1001 1007 #ifndef VBOX_COLLECTOR_TEST_CASE 1008 void MachineNetRate::init(ULONG period, ULONG length) 1009 { 1010 mPeriod = period; 1011 mLength = length; 1012 1013 mRx->init(mLength); 1014 mTx->init(mLength); 1015 } 1016 1017 void MachineNetRate::collect() 1018 { 1019 if (mCGuest->isValid(VMSTATS_NET_RATE)) 1020 { 1021 mRx->put(mCGuest->getVmNetRx()); 1022 mTx->put(mCGuest->getVmNetTx()); 1023 mCGuest->invalidate(VMSTATS_NET_RATE); 1024 } 1025 } 1026 1027 int MachineNetRate::enable() 1028 { 1029 int rc = mCGuest->enable(VMSTATS_NET_RATE); 1030 BaseMetric::enable(); 1031 return rc; 1032 } 1033 1034 int MachineNetRate::disable() 1035 { 1036 BaseMetric::disable(); 1037 return mCGuest->disable(VMSTATS_NET_RATE); 1038 } 1039 1040 void MachineNetRate::preCollect(CollectorHints& hints, uint64_t /* iTick */) 1041 { 1042 hints.collectGuestStats(mCGuest->getProcess()); 1043 } 1044 1002 1045 void GuestCpuLoad::init(ULONG period, ULONG length) 1003 1046 { … … 1017 1060 void GuestCpuLoad::collect() 1018 1061 { 1019 if (mCGuest->isValid( GUESTSTATS_CPULOAD))1062 if (mCGuest->isValid(VMSTATS_GUEST_CPULOAD)) 1020 1063 { 1021 1064 mUser->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * mCGuest->getCpuUser()) / 100); 1022 1065 mKernel->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * mCGuest->getCpuKernel()) / 100); 1023 1066 mIdle->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * mCGuest->getCpuIdle()) / 100); 1024 mCGuest->invalidate( GUESTSTATS_CPULOAD);1067 mCGuest->invalidate(VMSTATS_GUEST_CPULOAD); 1025 1068 } 1026 1069 } … … 1028 1071 int GuestCpuLoad::enable() 1029 1072 { 1030 int rc = mCGuest->enable( GUESTSTATS_CPULOAD);1073 int rc = mCGuest->enable(VMSTATS_GUEST_CPULOAD); 1031 1074 BaseMetric::enable(); 1032 1075 return rc; … … 1036 1079 { 1037 1080 BaseMetric::disable(); 1038 return mCGuest->disable( GUESTSTATS_CPULOAD);1081 return mCGuest->disable(VMSTATS_GUEST_CPULOAD); 1039 1082 } 1040 1083 … … 1054 1097 void GuestRamUsage::collect() 1055 1098 { 1056 if (mCGuest->isValid( GUESTSTATS_RAMUSAGE))1099 if (mCGuest->isValid(VMSTATS_GUEST_RAMUSAGE)) 1057 1100 { 1058 1101 mTotal->put(mCGuest->getMemTotal()); … … 1062 1105 mCache->put(mCGuest->getMemCache()); 1063 1106 mPagedTotal->put(mCGuest->getPageTotal()); 1064 mCGuest->invalidate( GUESTSTATS_RAMUSAGE);1107 mCGuest->invalidate(VMSTATS_GUEST_RAMUSAGE); 1065 1108 } 1066 1109 } … … 1068 1111 int GuestRamUsage::enable() 1069 1112 { 1070 int rc = mCGuest->enable( GUESTSTATS_RAMUSAGE);1113 int rc = mCGuest->enable(VMSTATS_GUEST_RAMUSAGE); 1071 1114 BaseMetric::enable(); 1072 1115 return rc; … … 1076 1119 { 1077 1120 BaseMetric::disable(); 1078 return mCGuest->disable( GUESTSTATS_RAMUSAGE);1121 return mCGuest->disable(VMSTATS_GUEST_RAMUSAGE); 1079 1122 } 1080 1123
Note:
See TracChangeset
for help on using the changeset viewer.