Changeset 43958 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Nov 26, 2012 10:37:06 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 82302
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/HostImpl.cpp
r43831 r43958 2936 2936 for (it = disks.begin(); it != disks.end(); ++it) 2937 2937 { 2938 Utf8StrFmt strName("Disk/%s /Load", it->c_str());2939 pm::SubMetric *fsLoadUtil = new pm::SubMetric(strName + "/ Util",2938 Utf8StrFmt strName("Disk/%s", it->c_str()); 2939 pm::SubMetric *fsLoadUtil = new pm::SubMetric(strName + "/Load/Util", 2940 2940 "Percentage of time disk was busy serving I/O requests."); 2941 pm::BaseMetric *fsLoad = new pm::HostDiskLoadRaw(hal, this, strName, 2941 pm::SubMetric *fsUsageTotal = new pm::SubMetric(strName + "/Usage/Total", 2942 "Disk size."); 2943 pm::BaseMetric *fsLoad = new pm::HostDiskLoadRaw(hal, this, strName + "/Load", 2942 2944 *it, fsLoadUtil); 2943 2945 aCollector->registerBaseMetric (fsLoad); 2946 pm::BaseMetric *fsUsage = new pm::HostDiskUsage(hal, this, strName + "/Usage", 2947 *it, fsUsageTotal); 2948 aCollector->registerBaseMetric (fsUsage); 2944 2949 2945 2950 aCollector->registerMetric(new pm::Metric(fsLoad, fsLoadUtil, 0)); … … 2949 2954 new pm::AggregateMin())); 2950 2955 aCollector->registerMetric(new pm::Metric(fsLoad, fsLoadUtil, 2956 new pm::AggregateMax())); 2957 2958 aCollector->registerMetric(new pm::Metric(fsUsage, fsUsageTotal, 0)); 2959 aCollector->registerMetric(new pm::Metric(fsUsage, fsUsageTotal, 2960 new pm::AggregateAvg())); 2961 aCollector->registerMetric(new pm::Metric(fsUsage, fsUsageTotal, 2962 new pm::AggregateMin())); 2963 aCollector->registerMetric(new pm::Metric(fsUsage, fsUsageTotal, 2951 2964 new pm::AggregateMax())); 2952 2965 } -
trunk/src/VBox/Main/src-server/Performance.cpp
r43949 r43958 82 82 83 83 int CollectorHAL::getHostFilesystemUsage(const char * /* name */, ULONG * /* total */, ULONG * /* used */, ULONG * /* available */) 84 { 85 return E_NOTIMPL; 86 } 87 88 int CollectorHAL::getHostDiskSize(const char * /* name */, uint64_t * /* size */) 84 89 { 85 90 return E_NOTIMPL; … … 859 864 } 860 865 866 void HostDiskUsage::init(ULONG period, ULONG length) 867 { 868 mPeriod = period; 869 mLength = length; 870 mTotal->init(mLength); 871 } 872 873 void HostDiskUsage::preCollect(CollectorHints& /* hints */, uint64_t /* iTick */) 874 { 875 } 876 877 void HostDiskUsage::collect() 878 { 879 uint64_t total; 880 int rc = mHAL->getHostDiskSize(mDiskName.c_str(), &total); 881 if (RT_SUCCESS(rc)) 882 mTotal->put((ULONG)(total / (1024*1024))); 883 } 884 861 885 #ifndef VBOX_COLLECTOR_TEST_CASE 862 886 void HostRamVmm::init(ULONG period, ULONG length) -
trunk/src/VBox/Main/src-server/linux/PerformanceLinux.cpp
r43845 r43958 49 49 virtual int getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available); 50 50 virtual int getHostFilesystemUsage(const char *name, ULONG *total, ULONG *used, ULONG *available); 51 virtual int getHostDiskSize(const char *name, uint64_t *size); 51 52 virtual int getProcessMemoryUsage(RTPROCESS process, ULONG *used); 52 53 … … 242 243 } 243 244 245 int CollectorLinux::getHostDiskSize(const char *name, uint64_t *size) 246 { 247 int rc = VINF_SUCCESS; 248 char *pszName = NULL; 249 long long unsigned int u64Size; 250 251 RTStrAPrintf(&pszName, "/sys/block/%s/size", name); 252 Assert(pszName); 253 FILE *f = fopen(pszName, "r"); 254 RTMemFree(pszName); 255 256 if (f) 257 { 258 if (fscanf(f, "%llu", &u64Size) == 1) 259 *size = u64Size * 512; 260 else 261 rc = VERR_FILE_IO_ERROR; 262 fclose(f); 263 } 264 else 265 rc = VERR_ACCESS_DENIED; 266 267 return rc; 268 } 269 244 270 int CollectorLinux::getProcessMemoryUsage(RTPROCESS process, ULONG *used) 245 271 {
Note:
See TracChangeset
for help on using the changeset viewer.