VirtualBox

忽略:
時間撮記:
2013-1-30 上午07:19:06 (12 年 以前)
作者:
vboxsync
訊息:

Main/Metrics: Adjust per-VM CPU load by number of cores on Solaris (#6345)

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Main/src-server/solaris/PerformanceSolaris.cpp

    r44031 r44450  
    100100
    101101    FsMap             mFsMap;
     102    uint32_t          mCpus;
    102103};
    103104
     
    114115      mSysPages(0),
    115116      mZFSCache(0),
    116       mZfsLib(0)
     117      mZfsLib(0),
     118      mCpus(0)
    117119{
    118120    if ((mKC = kstat_open()) == 0)
     
    155157
    156158    updateFilesystemMap();
     159    /* Notice that mCpus member will be initialized by HostCpuLoadRaw::init() */
    157160}
    158161
     
    196199        return VERR_INTERNAL_ERROR;
    197200    }
     201    else
     202        mCpus = cpus;
    198203
    199204    if (user)   *user   = tmpUser;
     
    221226            //Assert((pid_t)process == pstatus.pr_pid);
    222227            //Log(("user=%u kernel=%u total=%u\n", prusage.pr_utime.tv_sec, prusage.pr_stime.tv_sec, prusage.pr_tstamp.tv_sec));
    223             *user = (uint64_t)prusage.pr_utime.tv_sec * 1000000000 + prusage.pr_utime.tv_nsec;
    224             *kernel = (uint64_t)prusage.pr_stime.tv_sec * 1000000000 + prusage.pr_stime.tv_nsec;
     228            /*
     229             * The CPU time spent must be adjusted by the number of cores for compatibility with
     230             * other platforms (see @bugref{6345}).
     231             */
     232            Assert(mCpus);
     233            if (mCpus)
     234            {
     235                *user = ((uint64_t)prusage.pr_utime.tv_sec * 1000000000 + prusage.pr_utime.tv_nsec) / mCpus;
     236                *kernel = ((uint64_t)prusage.pr_stime.tv_sec * 1000000000 + prusage.pr_stime.tv_nsec) / mCpus;
     237            }
     238            else
     239                *user = *kernel = 0;
    225240            *total = (uint64_t)prusage.pr_tstamp.tv_sec * 1000000000 + prusage.pr_tstamp.tv_nsec;
    226241            //Log(("user=%llu kernel=%llu total=%llu\n", *user, *kernel, *total));
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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