Changeset 46328 in vbox for trunk/src/VBox/Main
- Timestamp:
- May 30, 2013 12:37:09 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86099
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/darwin/PerformanceDarwin.cpp
r44529 r46328 66 66 virtual int getProcessMemoryUsage(RTPROCESS process, ULONG *used); 67 67 private: 68 ULONG totalRAM;68 ULONG totalRAM; 69 69 uint32_t nCpus; 70 70 }; … … 116 116 int CollectorDarwin::getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available) 117 117 { 118 AssertReturn(totalRAM, VERR_INTERNAL_ERROR); 118 119 uint64_t cb; 119 120 int rc = RTSystemQueryAvailableRam(&cb); -
trunk/src/VBox/Main/src-server/linux/PerformanceLinux.cpp
r45051 r46328 30 30 #include <iprt/path.h> 31 31 #include <iprt/string.h> 32 #include <iprt/system.h> 32 33 #include <iprt/mp.h> 33 34 … … 80 81 uint64_t mSingleUser, mSingleKernel, mSingleIdle; 81 82 uint32_t mHZ; 83 ULONG totalRAM; 82 84 }; 83 85 … … 100 102 mHZ = hz; 101 103 LogFlowThisFunc(("mHZ=%u\n", mHZ)); 104 105 uint64_t cb; 106 int rc = RTSystemQueryTotalRam(&cb); 107 if (RT_FAILURE(rc)) 108 totalRAM = 0; 109 else 110 totalRAM = (ULONG)(cb / 1024); 102 111 } 103 112 … … 202 211 int CollectorLinux::getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available) 203 212 { 204 int rc = VINF_SUCCESS; 205 ULONG buffers, cached; 206 FILE *f = fopen("/proc/meminfo", "r"); 207 208 if (f) 209 { 210 int processed = fscanf(f, "MemTotal: %u kB\n", total); 211 processed += fscanf(f, "MemFree: %u kB\n", available); 212 processed += fscanf(f, "Buffers: %u kB\n", &buffers); 213 processed += fscanf(f, "Cached: %u kB\n", &cached); 214 if (processed == 4) 215 { 216 *available += buffers + cached; 217 *used = *total - *available; 218 } 219 else 220 rc = VERR_FILE_IO_ERROR; 221 fclose(f); 222 } 223 else 224 rc = VERR_ACCESS_DENIED; 225 213 AssertReturn(totalRAM, VERR_INTERNAL_ERROR); 214 uint64_t cb; 215 int rc = RTSystemQueryAvailableRam(&cb); 216 if (RT_SUCCESS(rc)) 217 { 218 *total = totalRAM; 219 *available = cb / 1024; 220 *used = *total - *available; 221 } 226 222 return rc; 227 223 } -
trunk/src/VBox/Main/src-server/solaris/PerformanceSolaris.cpp
r46320 r46328 105 105 FsMap mFsMap; 106 106 uint32_t mCpus; 107 108 107 ULONG totalRAM; 109 108 }; … … 282 281 int CollectorSolaris::getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available) 283 282 { 284 uint64_t cb; 285 int rc = RTSystemQueryAvailableRam(&cb); 286 if (RT_SUCCESS(rc)) 287 { 288 *total = totalRAM; 289 *available = cb / 1024; 290 *used = *total - *available; 291 } 292 return rc; 283 AssertReturn(totalRAM, VERR_INTERNAL_ERROR); 284 uint64_t cb; 285 int rc = RTSystemQueryAvailableRam(&cb); 286 if (RT_SUCCESS(rc)) 287 { 288 *total = totalRAM; 289 *available = cb / 1024; 290 *used = *total - *available; 291 } 292 return rc; 293 293 } 294 294 -
trunk/src/VBox/Main/src-server/win/PerformanceWin.cpp
r46321 r46328 90 90 HMODULE mhNtDll; 91 91 92 ULONG totalRAM;92 ULONG totalRAM; 93 93 }; 94 94 … … 311 311 int CollectorWin::getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available) 312 312 { 313 AssertReturn(totalRAM, VERR_INTERNAL_ERROR); 313 314 uint64_t cb; 314 315 int rc = RTSystemQueryAvailableRam(&cb);
Note:
See TracChangeset
for help on using the changeset viewer.