VirtualBox

Changeset 11478 in vbox for trunk/src/VBox/Main/linux


Ignore:
Timestamp:
Aug 19, 2008 12:11:10 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
34963
Message:

PerfAPI: Linux implementation of CPU/MHz counter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/linux/PerformanceLinux.cpp

    r11386 r11478  
    2525#include <iprt/alloc.h>
    2626#include <iprt/err.h>
     27#include <iprt/mp.h>
    2728#include <iprt/param.h>
    2829#include <iprt/string.h>
     
    9697int CollectorLinux::getHostCpuMHz(ULONG *mhz)
    9798{
    98     return E_NOTIMPL;
     99    RTCPUID nProcessors = RTMpGetCount();
     100    uint64_t uTotalMHz  = 0;
     101
     102    for (RTCPUID i = 0; i < nProcessors; ++i)
     103        uTotalMHz += RTMpGetCurFrequency(i);
     104
     105    *mhz = (ULONG)(uTotalMHz / nProcessors);
     106    return VINF_SUCCESS;
    99107}
    100108
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