VirtualBox

Ignore:
Timestamp:
Jan 30, 2013 6:59:04 PM (12 years ago)
Author:
vboxsync
Message:

Main/Metrics: Per-VM CPU load fix for Darwin (#6345)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/darwin/PerformanceDarwin.cpp

    r44467 r44475  
    2525#include <iprt/err.h>
    2626#include <iprt/log.h>
     27#include <iprt/mp.h>
    2728#include <iprt/param.h>
    2829#include <iprt/system.h>
     
    6667private:
    6768    ULONG totalRAM;
     69    uint32_t nCpus;
    6870};
    6971
     
    8183    else
    8284        totalRAM = (ULONG)(cb / 1024);
     85    nCpus = RTMpGetOnlineCount();
     86    Assert(nCpus);
     87    if (nCpus == 0)
     88    {
     89        /* It is rather unsual to have no CPUs, but the show must go on. */
     90        nCpus = 1;
     91    }
    8392}
    8493
     
    143152    if (RT_SUCCESS(rc))
    144153    {
    145         *user = tinfo.pti_total_user;
    146         *kernel = tinfo.pti_total_system;
     154        /*
     155         * Adjust user and kernel values so 100% is when ALL cores are fully
     156         * utilized (see @bugref{6345}).
     157         */
     158        *user = tinfo.pti_total_user / nCpus;
     159        *kernel = tinfo.pti_total_system / nCpus;
    147160        *total = mach_absolute_time();
    148161    }
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