VirtualBox

Changeset 12136 in vbox


Ignore:
Timestamp:
Sep 5, 2008 3:17:44 PM (16 years ago)
Author:
vboxsync
Message:

PerfAPI: perf test enhancements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/testcase/tstCollector.cpp

    r12133 r12136  
    6666}
    6767
    68 #define CALLS_PER_SECOND(fn) \
     68#define CALLS_PER_SECOND(n,fn) \
    6969    nCalls = 0; \
    7070    start = RTTimeMilliTS(); \
     
    7878    } \
    7979    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
    8182
    8283int main(int argc, char *argv[])
     
    221222    ULONG tmp;
    222223    uint64_t tmp64;
     224    uint32_t totalTime = 0;
    223225    RTPROCESS pid = RTProcSelf();
    224226    /* Host CPU load */
    225     CALLS_PER_SECOND(getRawHostCpuLoad(&tmp64, &tmp64, &tmp64));
     227    CALLS_PER_SECOND(1, getRawHostCpuLoad(&tmp64, &tmp64, &tmp64));
    226228    /* Process CPU load */
    227     CALLS_PER_SECOND(getRawProcessCpuLoad(pid, &tmp64, &tmp64, &tmp64));
     229    CALLS_PER_SECOND(100, getRawProcessCpuLoad(pid, &tmp64, &tmp64, &tmp64));
    228230    /* Host CPU speed */
    229     CALLS_PER_SECOND(getHostCpuMHz(&tmp));
     231    CALLS_PER_SECOND(1, getHostCpuMHz(&tmp));
    230232    /* Host RAM usage */
    231     CALLS_PER_SECOND(getHostMemoryUsage(&tmp, &tmp, &tmp));
     233    CALLS_PER_SECOND(1, getHostMemoryUsage(&tmp, &tmp, &tmp));
    232234    /* 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.);
    234238   
    235239    delete collector;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette