Changeset 43445 in vbox for trunk/src/VBox/Main/include
- Timestamp:
- Sep 27, 2012 8:28:59 AM (12 years ago)
- Location:
- trunk/src/VBox/Main/include
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/HostImpl.h
r36615 r43445 145 145 #endif 146 146 147 HRESULT updateNetIfList(); 148 147 149 #ifdef VBOX_WITH_RESOURCE_USAGE_API 148 150 void registerMetrics(PerformanceCollector *aCollector); -
trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h
r42551 r43445 79 79 80 80 HRESULT setVirtualBox(VirtualBox *pVBox); 81 void registerMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr); 82 void unregisterMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr); 81 83 82 84 private: … … 112 114 }; 113 115 116 typedef std::list<ComObjPtr<HostNetworkInterface> > HostNetworkInterfaceList; 117 114 118 #endif // ____H_H_HOSTNETWORKINTERFACEIMPL 115 119 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/include/Performance.h
r40358 r43445 40 40 /* CPU load is measured in 1/1000 of per cent. */ 41 41 const uint64_t PM_CPU_LOAD_MULTIPLIER = UINT64_C(100000); 42 /* Network load is measured in 1/1000 of per cent. */ 43 const uint64_t PM_NETWORK_LOAD_MULTIPLIER = UINT64_C(100000); 44 /* Sampler precision in milliseconds. */ 45 const uint64_t PM_SAMPLER_PRECISION_MS = 50; 42 46 43 47 /* Sub Metrics **********************************************************/ … … 63 67 { 64 68 public: 65 SubMetric(co nst char *name, const char *description)69 SubMetric(com::Utf8Str name, const char *description) 66 70 : mName(name), mDescription(description) {}; 67 71 void query(ULONG *data); 68 const char *getName() { return mName ; };72 const char *getName() { return mName.c_str(); }; 69 73 const char *getDescription() { return mDescription; }; 70 74 private: 71 const c har *mName;75 const com::Utf8Str mName; 72 76 const char *mDescription; 73 77 }; … … 357 361 /** Returns CPU usage counters in platform-specific units. */ 358 362 virtual int getRawHostCpuLoad(uint64_t *user, uint64_t *kernel, uint64_t *idle); 363 /** Returns received and transmitted bytes as well as link speed. */ 364 virtual int getRawHostNetworkLoad(const char *name, uint64_t *rx, uint64_t *tx, uint64_t *speed); 359 365 /** Returns process' CPU usage counter in platform-specific units. */ 360 366 virtual int getRawProcessCpuLoad(RTPROCESS process, uint64_t *user, uint64_t *kernel, uint64_t *total); … … 367 373 { 368 374 public: 369 BaseMetric(CollectorHAL *hal, const c har *name, ComPtr<IUnknown> object)375 BaseMetric(CollectorHAL *hal, const com::Utf8Str name, ComPtr<IUnknown> object) 370 376 : mPeriod(0), mLength(0), mHAL(hal), mName(name), mObject(object), 371 377 mLastSampleTaken(0), mEnabled(false), mUnregistered(false) {}; … … 390 396 ULONG getPeriod() { return mPeriod; }; 391 397 ULONG getLength() { return mLength; }; 392 const char *getName() { return mName ; };398 const char *getName() { return mName.c_str(); }; 393 399 ComPtr<IUnknown> getObject() { return mObject; }; 394 400 bool associatedWith(ComPtr<IUnknown> object) { return mObject == object; }; … … 398 404 ULONG mLength; 399 405 CollectorHAL *mHAL; 400 const c har *mName;406 const com::Utf8Str mName; 401 407 ComPtr<IUnknown> mObject; 402 408 uint64_t mLastSampleTaken; … … 486 492 SubMetric *mAvailable; 487 493 }; 494 495 class HostNetworkLoadRaw : public BaseMetric 496 { 497 public: 498 HostNetworkLoadRaw(CollectorHAL *hal, ComPtr<IUnknown> object, com::Utf8Str name, com::Utf8Str ifname, SubMetric *rx, SubMetric *tx) 499 : BaseMetric(hal, name, object), mInterfaceName(ifname), mRx(rx), mTx(tx), mRxPrev(0), mTxPrev(0) {}; 500 ~HostNetworkLoadRaw() { delete mRx; delete mTx; }; 501 502 void init(ULONG period, ULONG length); 503 504 void preCollect(CollectorHints& hints, uint64_t iTick); 505 void collect(); 506 const char *getUnit() { return "%"; }; 507 ULONG getMinValue() { return 0; }; 508 ULONG getMaxValue() { return PM_NETWORK_LOAD_MULTIPLIER; }; 509 ULONG getScale() { return PM_NETWORK_LOAD_MULTIPLIER / 100; } 510 511 private: 512 com::Utf8Str mInterfaceName; 513 SubMetric *mRx; 514 SubMetric *mTx; 515 uint64_t mRxPrev; 516 uint64_t mTxPrev; 517 }; 518 488 519 489 520 #ifndef VBOX_COLLECTOR_TEST_CASE
Note:
See TracChangeset
for help on using the changeset viewer.