Changeset 43908 in vbox
- Timestamp:
- Nov 19, 2012 5:36:43 AM (12 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r43869 r43908 3044 3044 <interface 3045 3045 name="IInternalMachineControl" extends="$unknown" 3046 uuid=" ec824977-e43f-479c-81c9-ac6cae1423a5"3046 uuid="dca36a92-703c-4649-98a4-f40c1ef0c336" 3047 3047 internal="yes" 3048 3048 wsmap="suppress" … … 3503 3503 </method> 3504 3504 3505 <method name="report GuestStatistics">3506 <desc> 3507 Passes collected guest statisticsto VBoxSVC.3505 <method name="reportVmStatistics"> 3506 <desc> 3507 Passes statistics collected by VM (including guest statistics) to VBoxSVC. 3508 3508 </desc> 3509 3509 <param name="validStats" type="unsigned long" dir="in"> … … 3551 3551 <param name="memSharedTotal" type="unsigned long" dir="in"> 3552 3552 <desc>Total amount of shared memory in the hypervisor.</desc> 3553 </param> 3554 <param name="vmNetRx" type="unsigned long" dir="in"> 3555 <desc>Network receive rate for VM.</desc> 3556 </param> 3557 <param name="vmNetTx" type="unsigned long" dir="in"> 3558 <desc>Network transmit rate for VM.</desc> 3553 3559 </param> 3554 3560 </method> -
trunk/src/VBox/Main/include/ConsoleImpl.h
r43584 r43908 239 239 240 240 void processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList, bool fDescExt); 241 void report GuestStatistics(ULONG aValidStats, ULONG aCpuUser,241 void reportVmStatistics(ULONG aValidStats, ULONG aCpuUser, 242 242 ULONG aCpuKernel, ULONG aCpuIdle, 243 243 ULONG aMemTotal, ULONG aMemFree, … … 245 245 ULONG aMemCache, ULONG aPageTotal, 246 246 ULONG aAllocVMM, ULONG aFreeVMM, 247 ULONG aBalloonedVMM, ULONG aSharedVMM) 247 ULONG aBalloonedVMM, ULONG aSharedVMM, 248 ULONG aVmNetRx, ULONG aVmNetTx) 248 249 { 249 mControl->Report GuestStatistics(aValidStats, aCpuUser, aCpuKernel, aCpuIdle,250 251 252 aBalloonedVMM, aSharedVMM);250 mControl->ReportVmStatistics(aValidStats, aCpuUser, aCpuKernel, aCpuIdle, 251 aMemTotal, aMemFree, aMemBalloon, aMemShared, 252 aMemCache, aPageTotal, aAllocVMM, aFreeVMM, 253 aBalloonedVMM, aSharedVMM, aVmNetRx, aVmNetTx); 253 254 } 254 255 void enableVMMStatistics(BOOL aEnable); -
trunk/src/VBox/Main/include/GuestImpl.h
r42897 r43908 22 22 #include <iprt/time.h> 23 23 #include <VBox/ostypes.h> 24 #include <VBox/vmm/stam.h> 24 25 25 26 #include "AdditionsFacilityImpl.h" … … 150 151 * @{ */ 151 152 void updateStats(uint64_t iTick); 153 static int staticEnumStatsCallback(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit, 154 STAMVISIBILITY enmVisiblity, const char *pszDesc, void *pvUser); 152 155 /** @} */ 153 156 … … 179 182 ULONG mMemoryBalloonSize; 180 183 ULONG mStatUpdateInterval; 184 uint64_t mNetStatRx; 185 uint64_t mNetStatTx; 186 uint64_t mNetStatLastTs; 181 187 ULONG mCurrentGuestStat[GUESTSTATTYPE_MAX]; 182 ULONG m GuestValidStats;188 ULONG mVmValidStats; 183 189 BOOL mCollectVMMStats; 184 190 BOOL mfPageFusionEnabled; -
trunk/src/VBox/Main/include/MachineImpl.h
r43870 r43908 1069 1069 STDMETHOD(EjectMedium)(IMediumAttachment *aAttachment, 1070 1070 IMediumAttachment **aNewAttachment); 1071 STDMETHOD(ReportGuestStatistics)(ULONG aValidStats, ULONG aCpuUser, 1072 ULONG aCpuKernel, ULONG aCpuIdle, 1073 ULONG aMemTotal, ULONG aMemFree, 1074 ULONG aMemBalloon, ULONG aMemShared, 1075 ULONG aMemCache, ULONG aPageTotal, 1076 ULONG aAllocVMM, ULONG aFreeVMM, 1077 ULONG aBalloonedVMM, ULONG aSharedVMM); 1071 STDMETHOD(ReportVmStatistics)(ULONG aValidStats, ULONG aCpuUser, 1072 ULONG aCpuKernel, ULONG aCpuIdle, 1073 ULONG aMemTotal, ULONG aMemFree, 1074 ULONG aMemBalloon, ULONG aMemShared, 1075 ULONG aMemCache, ULONG aPageTotal, 1076 ULONG aAllocVMM, ULONG aFreeVMM, 1077 ULONG aBalloonedVMM, ULONG aSharedVMM, 1078 ULONG aVmNetRx, ULONG aVmNetTx); 1078 1079 1079 1080 // public methods only for internal purposes -
trunk/src/VBox/Main/include/Performance.h
r43831 r43908 154 154 typedef enum 155 155 { 156 GUESTSTATMASK_NONE = 0x00000000, 157 GUESTSTATMASK_CPUUSER = 0x00000001, 158 GUESTSTATMASK_CPUKERNEL = 0x00000002, 159 GUESTSTATMASK_CPUIDLE = 0x00000004, 160 GUESTSTATMASK_MEMTOTAL = 0x00000008, 161 GUESTSTATMASK_MEMFREE = 0x00000010, 162 GUESTSTATMASK_MEMBALLOON = 0x00000020, 163 GUESTSTATMASK_MEMSHARED = 0x00000040, 164 GUESTSTATMASK_MEMCACHE = 0x00000080, 165 GUESTSTATMASK_PAGETOTAL = 0x00000100, 166 GUESTSTATMASK_ALLOCVMM = 0x00000200, 167 GUESTSTATMASK_FREEVMM = 0x00000400, 168 GUESTSTATMASK_BALOONVMM = 0x00000800, 169 GUESTSTATMASK_SHAREDVMM = 0x00001000 170 } GUESTSTATMASK; 171 172 const ULONG GUESTSTATS_CPULOAD = 173 GUESTSTATMASK_CPUUSER|GUESTSTATMASK_CPUKERNEL|GUESTSTATMASK_CPUIDLE; 174 const ULONG GUESTSTATS_RAMUSAGE = 175 GUESTSTATMASK_MEMTOTAL|GUESTSTATMASK_MEMFREE|GUESTSTATMASK_MEMBALLOON| 176 GUESTSTATMASK_MEMSHARED|GUESTSTATMASK_MEMCACHE| 177 GUESTSTATMASK_PAGETOTAL; 178 const ULONG GUESTSTATS_VMMRAM = 179 GUESTSTATMASK_ALLOCVMM|GUESTSTATMASK_FREEVMM| 180 GUESTSTATMASK_BALOONVMM|GUESTSTATMASK_SHAREDVMM; 181 const ULONG GUESTSTATS_ALL = GUESTSTATS_CPULOAD|GUESTSTATS_RAMUSAGE|GUESTSTATS_VMMRAM; 182 156 VMSTATMASK_NONE = 0x00000000, 157 VMSTATMASK_GUEST_CPUUSER = 0x00000001, 158 VMSTATMASK_GUEST_CPUKERNEL = 0x00000002, 159 VMSTATMASK_GUEST_CPUIDLE = 0x00000004, 160 VMSTATMASK_GUEST_MEMTOTAL = 0x00000008, 161 VMSTATMASK_GUEST_MEMFREE = 0x00000010, 162 VMSTATMASK_GUEST_MEMBALLOON = 0x00000020, 163 VMSTATMASK_GUEST_MEMSHARED = 0x00000040, 164 VMSTATMASK_GUEST_MEMCACHE = 0x00000080, 165 VMSTATMASK_GUEST_PAGETOTAL = 0x00000100, 166 VMSTATMASK_VMM_ALLOC = 0x00010000, 167 VMSTATMASK_VMM_FREE = 0x00020000, 168 VMSTATMASK_VMM_BALOON = 0x00040000, 169 VMSTATMASK_VMM_SHARED = 0x00080000, 170 VMSTATMASK_NET_RX = 0x01000000, 171 VMSTATMASK_NET_TX = 0x02000000 172 } VMSTATMASK; 173 174 const ULONG VMSTATS_GUEST_CPULOAD = 175 VMSTATMASK_GUEST_CPUUSER | VMSTATMASK_GUEST_CPUKERNEL | 176 VMSTATMASK_GUEST_CPUIDLE; 177 const ULONG VMSTATS_GUEST_RAMUSAGE = 178 VMSTATMASK_GUEST_MEMTOTAL | VMSTATMASK_GUEST_MEMFREE | 179 VMSTATMASK_GUEST_MEMBALLOON | VMSTATMASK_GUEST_MEMSHARED | 180 VMSTATMASK_GUEST_MEMCACHE | VMSTATMASK_GUEST_PAGETOTAL; 181 const ULONG VMSTATS_VMM_RAM = 182 VMSTATMASK_VMM_ALLOC | VMSTATMASK_VMM_FREE| 183 VMSTATMASK_VMM_BALOON | VMSTATMASK_VMM_SHARED; 184 const ULONG VMSTATS_NET_RATE = 185 VMSTATMASK_NET_RX | VMSTATMASK_NET_TX; 186 const ULONG VMSTATS_ALL = 187 VMSTATS_GUEST_CPULOAD | VMSTATS_GUEST_RAMUSAGE | 188 VMSTATS_VMM_RAM | VMSTATS_NET_RATE; 183 189 class CollectorGuest; 184 190 … … 266 272 ULONG aMemCache, ULONG aPageTotal, 267 273 ULONG aAllocVMM, ULONG aFreeVMM, 268 ULONG aBalloonedVMM, ULONG aSharedVMM); 274 ULONG aBalloonedVMM, ULONG aSharedVMM, 275 ULONG aVmNetRx, ULONG aVmNetTx); 269 276 int enable(ULONG mask); 270 277 int disable(ULONG mask); … … 290 297 ULONG getBalloonedVMM() { return mBalloonedVMM; }; 291 298 ULONG getSharedVMM() { return mSharedVMM; }; 299 ULONG getVmNetRx() { return mVmNetRx; }; 300 ULONG getVmNetTx() { return mVmNetTx; }; 292 301 293 302 private: … … 317 326 ULONG mBalloonedVMM; 318 327 ULONG mSharedVMM; 328 ULONG mVmNetRx; 329 ULONG mVmNetTx; 319 330 }; 320 331 … … 663 674 664 675 #ifndef VBOX_COLLECTOR_TEST_CASE 676 /* 677 * Although MachineNetRate is measured for VM, not for the guest, it is 678 * derived from BaseGuestMetric since it uses the same mechanism for 679 * data collection -- values get pushed by Guest class along with other 680 * guest statistics. 681 */ 682 class MachineNetRate : public BaseGuestMetric 683 { 684 public: 685 MachineNetRate(CollectorGuest *cguest, ComPtr<IUnknown> object, SubMetric *rx, SubMetric *tx) 686 : BaseGuestMetric(cguest, "Net/Rate", object), mRx(rx), mTx(tx) {}; 687 ~MachineNetRate() { delete mRx; delete mTx; }; 688 689 void init(ULONG period, ULONG length); 690 void preCollect(CollectorHints& hints, uint64_t iTick); 691 void collect(); 692 int enable(); 693 int disable(); 694 const char *getUnit() { return "B/s"; }; 695 ULONG getMinValue() { return 0; }; 696 ULONG getMaxValue() { return INT32_MAX; }; 697 ULONG getScale() { return 1; } 698 private: 699 SubMetric *mRx, *mTx; 700 }; 701 665 702 class GuestCpuLoad : public BaseGuestMetric 666 703 { -
trunk/src/VBox/Main/src-client/GuestImpl.cpp
r42919 r43908 33 33 #include <VBox/VMMDev.h> 34 34 #include <iprt/cpp/utils.h> 35 #include <iprt/ctype.h> 36 #include <iprt/stream.h> 35 37 #include <iprt/timer.h> 36 38 #include <VBox/vmm/pgm.h> … … 95 97 96 98 /* Clear statistics. */ 99 mNetStatRx = mNetStatTx = 0; 100 mNetStatLastTs = RTTimeNanoTS(); 97 101 for (unsigned i = 0 ; i < GUESTSTATTYPE_MAX; i++) 98 102 mCurrentGuestStat[i] = 0; 99 m GuestValidStats = pm::GUESTSTATMASK_NONE;103 mVmValidStats = pm::VMSTATMASK_NONE; 100 104 101 105 mMagic = GUEST_MAGIC; … … 180 184 } 181 185 186 /* static */ 187 int Guest::staticEnumStatsCallback(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit, 188 STAMVISIBILITY enmVisiblity, const char *pszDesc, void *pvUser) 189 { 190 PSTAMCOUNTER pCnt = (PSTAMCOUNTER)pvSample; 191 char *pszEnd = strrchr((char*)pszName, '/'); 192 if (pszEnd) 193 { 194 bool fRx; 195 uint8_t uInstance = 0; 196 197 switch (pszEnd[1]) 198 { 199 case 'R': 200 fRx = true; 201 break; 202 case 'T': 203 fRx = false; 204 break; 205 default: 206 LogRel(("Failed to parse the name of network stat counter (unknown counter): %s\n", pszName)); 207 return VINF_SUCCESS; 208 } 209 do 210 --pszEnd; 211 while (pszEnd > pszName && RT_C_IS_DIGIT(*pszEnd)); 212 if (RT_SUCCESS(RTStrToUInt8Ex(pszEnd + 1, NULL, 10, &uInstance))) 213 { 214 Guest *pGuest = (Guest *)pvUser; 215 LogFlowFunc(("%s i=%u d=%s %llu %s\n", pszName, uInstance, fRx ? "RX" : "TX", 216 pCnt->c, STAMR3GetUnit(enmUnit))); 217 if (fRx) 218 pGuest->mNetStatRx += pCnt->c; 219 else 220 pGuest->mNetStatTx += pCnt->c; 221 } 222 else 223 LogRel(("Failed to extract the device instance from the name of network stat counter: %s\n", pszEnd)); 224 } 225 else 226 LogRel(("Failed to parse the name of network stat counter (no slash): %s\n", pszName)); 227 228 return VINF_SUCCESS; 229 } 230 182 231 void Guest::updateStats(uint64_t iTick) 183 232 { … … 187 236 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 188 237 238 ULONG uNetStatRx = 0; 239 ULONG uNetStatTx = 0; 189 240 ULONG aGuestStats[GUESTSTATTYPE_MAX]; 190 241 RT_ZERO(aGuestStats); 191 ULONG validStats = m GuestValidStats;242 ULONG validStats = mVmValidStats; 192 243 /* Check if we have anything to report */ 193 244 if (validStats) 194 245 { 195 m GuestValidStats = pm::GUESTSTATMASK_NONE;246 mVmValidStats = pm::VMSTATMASK_NONE; 196 247 memcpy(aGuestStats, mCurrentGuestStat, sizeof(aGuestStats)); 197 248 } … … 226 277 if (rc == VINF_SUCCESS) 227 278 { 228 validStats |= pm:: GUESTSTATMASK_MEMSHARED;279 validStats |= pm::VMSTATMASK_GUEST_MEMSHARED; 229 280 } 230 281 } … … 236 287 if (rc == VINF_SUCCESS) 237 288 { 238 validStats |= pm::GUESTSTATMASK_ALLOCVMM|pm::GUESTSTATMASK_FREEVMM| 239 pm::GUESTSTATMASK_BALOONVMM|pm::GUESTSTATMASK_SHAREDVMM; 289 validStats |= 290 pm::VMSTATMASK_VMM_ALLOC | pm::VMSTATMASK_VMM_FREE | 291 pm::VMSTATMASK_VMM_BALOON | pm::VMSTATMASK_VMM_SHARED; 240 292 } 241 293 } 242 294 243 } 244 245 mParent->reportGuestStatistics(validStats, 246 aGuestStats[GUESTSTATTYPE_CPUUSER], 247 aGuestStats[GUESTSTATTYPE_CPUKERNEL], 248 aGuestStats[GUESTSTATTYPE_CPUIDLE], 249 /* Convert the units for RAM usage stats: page (4K) -> 1KB units */ 250 mCurrentGuestStat[GUESTSTATTYPE_MEMTOTAL] * (_4K/_1K), 251 mCurrentGuestStat[GUESTSTATTYPE_MEMFREE] * (_4K/_1K), 252 mCurrentGuestStat[GUESTSTATTYPE_MEMBALLOON] * (_4K/_1K), 253 (ULONG)(uSharedMem / _1K), /* bytes -> KB */ 254 mCurrentGuestStat[GUESTSTATTYPE_MEMCACHE] * (_4K/_1K), 255 mCurrentGuestStat[GUESTSTATTYPE_PAGETOTAL] * (_4K/_1K), 256 (ULONG)(uAllocTotal / _1K), /* bytes -> KB */ 257 (ULONG)(uFreeTotal / _1K), 258 (ULONG)(uBalloonedTotal / _1K), 259 (ULONG)(uSharedTotal / _1K)); 295 uint64_t uRxPrev = mNetStatRx; 296 uint64_t uTxPrev = mNetStatTx; 297 mNetStatRx = mNetStatTx = 0; 298 rc = STAMR3Enum(pVM, "*/ReceiveBytes|*/TransmitBytes", staticEnumStatsCallback, this); 299 uint64_t uTsNow = RTTimeNanoTS(); 300 uint64_t uTimePassed = uTsNow - mNetStatLastTs; 301 mNetStatLastTs = uTsNow; 302 uNetStatRx = (ULONG)((mNetStatRx - uRxPrev) * 1000000 / (uTimePassed / 1000)); /* in bytes per second */ 303 uNetStatTx = (ULONG)((mNetStatTx - uTxPrev) * 1000000 / (uTimePassed / 1000)); /* in bytes per second */ 304 LogFlowThisFunc(("Net Rx=%llu Tx=%llu Ts=%llu Delta=%llu\n", mNetStatRx, mNetStatTx, uTsNow, uTimePassed)); 305 AssertRC(rc); 306 validStats |= pm::VMSTATMASK_NET_RX | pm::VMSTATMASK_NET_TX; 307 } 308 309 mParent->reportVmStatistics(validStats, 310 aGuestStats[GUESTSTATTYPE_CPUUSER], 311 aGuestStats[GUESTSTATTYPE_CPUKERNEL], 312 aGuestStats[GUESTSTATTYPE_CPUIDLE], 313 /* Convert the units for RAM usage stats: page (4K) -> 1KB units */ 314 mCurrentGuestStat[GUESTSTATTYPE_MEMTOTAL] * (_4K/_1K), 315 mCurrentGuestStat[GUESTSTATTYPE_MEMFREE] * (_4K/_1K), 316 mCurrentGuestStat[GUESTSTATTYPE_MEMBALLOON] * (_4K/_1K), 317 (ULONG)(uSharedMem / _1K), /* bytes -> KB */ 318 mCurrentGuestStat[GUESTSTATTYPE_MEMCACHE] * (_4K/_1K), 319 mCurrentGuestStat[GUESTSTATTYPE_PAGETOTAL] * (_4K/_1K), 320 (ULONG)(uAllocTotal / _1K), /* bytes -> KB */ 321 (ULONG)(uFreeTotal / _1K), 322 (ULONG)(uBalloonedTotal / _1K), 323 (ULONG)(uSharedTotal / _1K), 324 uNetStatRx, 325 uNetStatTx); 260 326 } 261 327 … … 620 686 static ULONG indexToPerfMask[] = 621 687 { 622 pm:: GUESTSTATMASK_CPUUSER,623 pm:: GUESTSTATMASK_CPUKERNEL,624 pm:: GUESTSTATMASK_CPUIDLE,625 pm:: GUESTSTATMASK_MEMTOTAL,626 pm:: GUESTSTATMASK_MEMFREE,627 pm:: GUESTSTATMASK_MEMBALLOON,628 pm:: GUESTSTATMASK_MEMCACHE,629 pm:: GUESTSTATMASK_PAGETOTAL,630 pm:: GUESTSTATMASK_NONE688 pm::VMSTATMASK_GUEST_CPUUSER, 689 pm::VMSTATMASK_GUEST_CPUKERNEL, 690 pm::VMSTATMASK_GUEST_CPUIDLE, 691 pm::VMSTATMASK_GUEST_MEMTOTAL, 692 pm::VMSTATMASK_GUEST_MEMFREE, 693 pm::VMSTATMASK_GUEST_MEMBALLOON, 694 pm::VMSTATMASK_GUEST_MEMCACHE, 695 pm::VMSTATMASK_GUEST_PAGETOTAL, 696 pm::VMSTATMASK_NONE 631 697 }; 632 698 AutoCaller autoCaller(this); … … 639 705 640 706 mCurrentGuestStat[enmType] = aVal; 641 m GuestValidStats |= indexToPerfMask[enmType];707 mVmValidStats |= indexToPerfMask[enmType]; 642 708 return S_OK; 643 709 } -
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.