Changeset 12136
- Timestamp:
- 09/05/08 17:17:44 (3 months ago)
- Files:
-
- trunk/src/VBox/Main/testcase/tstCollector.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/VBox/Main/testcase/tstCollector.cpp
r12133 r12136 66 66 } 67 67 68 #define CALLS_PER_SECOND( fn) \68 #define CALLS_PER_SECOND(n,fn) \ 69 69 nCalls = 0; \ 70 70 start = RTTimeMilliTS(); \ … … 78 78 } \ 79 79 else \ 80 RTPrintf("%50s -- %u calls per second\n", #fn, nCalls) 80 RTPrintf("%50s -- %u calls per second\n", #fn, nCalls); \ 81 totalTime += n * 1000000 / nCalls 81 82 82 83 int main(int argc, char *argv[]) … … 221 222 ULONG tmp; 222 223 uint64_t tmp64; 224 uint32_t totalTime = 0; 223 225 RTPROCESS pid = RTProcSelf(); 224 226 /* Host CPU load */ 225 CALLS_PER_SECOND( getRawHostCpuLoad(&tmp64, &tmp64, &tmp64));227 CALLS_PER_SECOND(1, getRawHostCpuLoad(&tmp64, &tmp64, &tmp64)); 226 228 /* Process CPU load */ 227 CALLS_PER_SECOND( getRawProcessCpuLoad(pid, &tmp64, &tmp64, &tmp64));229 CALLS_PER_SECOND(100, getRawProcessCpuLoad(pid, &tmp64, &tmp64, &tmp64)); 228 230 /* Host CPU speed */ 229 CALLS_PER_SECOND( getHostCpuMHz(&tmp));231 CALLS_PER_SECOND(1, getHostCpuMHz(&tmp)); 230 232 /* Host RAM usage */ 231 CALLS_PER_SECOND( getHostMemoryUsage(&tmp, &tmp, &tmp));233 CALLS_PER_SECOND(1, getHostMemoryUsage(&tmp, &tmp, &tmp)); 232 234 /* Process RAM usage */ 233 CALLS_PER_SECOND(getProcessMemoryUsage(pid, &tmp)); 235 CALLS_PER_SECOND(100, getProcessMemoryUsage(pid, &tmp)); 236 237 printf("%.2f%% of CPU time\n", totalTime / 10000.); 234 238 235 239 delete collector;

