Changeset 43949 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Nov 23, 2012 1:43:19 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 82282
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r43915 r43949 11461 11461 #ifdef VBOX_WITH_RESOURCE_USAGE_API 11462 11462 11463 void Machine::getDiskList(MediaList &list) 11464 { 11465 for (MediaData::AttachmentList::const_iterator it = mMediaData->mAttachments.begin(); 11466 it != mMediaData->mAttachments.end(); 11467 ++it) 11468 { 11469 MediumAttachment* pAttach = *it; 11470 /* just in case */ 11471 AssertStmt(pAttach, continue); 11472 11473 AutoCaller localAutoCallerA(pAttach); 11474 if (FAILED(localAutoCallerA.rc())) continue; 11475 11476 AutoReadLock local_alockA(pAttach COMMA_LOCKVAL_SRC_POS); 11477 11478 if (pAttach->getType() == DeviceType_HardDisk) 11479 list.push_back(pAttach->getMedium()); 11480 } 11481 } 11482 11463 11483 void Machine::registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid) 11464 11484 { … … 11474 11494 pm::SubMetric *ramUsageUsed = new pm::SubMetric("RAM/Usage/Used", 11475 11495 "Size of resident portion of VM process in memory."); 11496 pm::SubMetric *diskUsageUsed = new pm::SubMetric("Disk/Usage/Used", 11497 "Actual size of all VM disks combined."); 11476 11498 pm::SubMetric *machineNetRx = new pm::SubMetric("Net/Rate/Rx", 11477 11499 "Network receive rate."); … … 11485 11507 ramUsageUsed); 11486 11508 aCollector->registerBaseMetric(ramUsage); 11509 MediaList disks; 11510 getDiskList(disks); 11511 pm::BaseMetric *diskUsage = new pm::MachineDiskUsage(hal, aMachine, disks, 11512 diskUsageUsed); 11513 aCollector->registerBaseMetric(diskUsage); 11487 11514 11488 11515 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 0)); … … 11507 11534 new pm::AggregateMin())); 11508 11535 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 11536 new pm::AggregateMax())); 11537 11538 aCollector->registerMetric(new pm::Metric(diskUsage, diskUsageUsed, 0)); 11539 aCollector->registerMetric(new pm::Metric(diskUsage, diskUsageUsed, 11540 new pm::AggregateAvg())); 11541 aCollector->registerMetric(new pm::Metric(diskUsage, diskUsageUsed, 11542 new pm::AggregateMin())); 11543 aCollector->registerMetric(new pm::Metric(diskUsage, diskUsageUsed, 11509 11544 new pm::AggregateMax())); 11510 11545 -
trunk/src/VBox/Main/src-server/Performance.cpp
r43908 r43949 25 25 #include "VirtualBoxImpl.h" 26 26 #include "MachineImpl.h" 27 #include "MediumImpl.h" 28 #include "AutoCaller.h" 27 29 #endif 28 30 #include "Performance.h" … … 1006 1008 1007 1009 #ifndef VBOX_COLLECTOR_TEST_CASE 1010 void MachineDiskUsage::init(ULONG period, ULONG length) 1011 { 1012 mPeriod = period; 1013 mLength = length; 1014 mUsed->init(mLength); 1015 } 1016 1017 void MachineDiskUsage::preCollect(CollectorHints& /* hints */, uint64_t /* iTick */) 1018 { 1019 } 1020 1021 void MachineDiskUsage::collect() 1022 { 1023 ULONG used = 0; 1024 1025 for (MediaList::iterator it = mDisks.begin(); it != mDisks.end(); ++it) 1026 { 1027 ComObjPtr<Medium> pMedium = *it; 1028 1029 /* just in case */ 1030 AssertStmt(!pMedium.isNull(), continue); 1031 1032 AutoCaller localAutoCaller(pMedium); 1033 if (FAILED(localAutoCaller.rc())) continue; 1034 1035 AutoReadLock local_alock(pMedium COMMA_LOCKVAL_SRC_POS); 1036 1037 used += pMedium->getSize() / (1024 * 1024); 1038 } 1039 1040 mUsed->put(used); 1041 } 1042 1008 1043 void MachineNetRate::init(ULONG period, ULONG length) 1009 1044 {
Note:
See TracChangeset
for help on using the changeset viewer.