VirtualBox

忽略:
時間撮記:
2008-7-9 下午06:39:22 (16 年 以前)
作者:
vboxsync
訊息:

Adjusted cpu frequency logic a bit. Make more generous assumptions about cur frequency, and be more strict with max frequency.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Runtime/r3/linux/mp-linux.cpp

    r10445 r10446  
    373373    if (kHz == -1)
    374374    {
    375         if (rtLinuxSysFsExists("devices/system/cpu/cpu%d/cpufreq/cpuinfo_cur_freq", (int)idCpu))
     375        /* The file may be just unreadable - in that case use plan B, i.e.
     376         * /proc/cpuinfo to get the data we want. The assumption is that if
     377         * cpuinfo_cur_freq doesn't exist then the speed won't change, and
     378         * thus cur == max. If it does exist then cpuinfo contains the
     379         * current frequency. */
     380        kHz = rtMpLinuxGetFrequency(idCpu) * 1000;
     381    }
     382    return (kHz + 999) / 1000;
     383}
     384
     385
     386RTDECL(uint32_t) RTMpGetMaxFrequency(RTCPUID idCpu)
     387{
     388    int64_t kHz = rtLinuxSysFsReadIntFile(0, "devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", (int)idCpu);
     389    if (kHz == -1)
     390    {
     391        /* Check if the file isn't there - if it is there, then /proc/cpuinfo
     392         * would provide current frequency information, which is wrong. */
     393        if (!rtLinuxSysFsExists("devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", (int)idCpu))
    376394            kHz = rtMpLinuxGetFrequency(idCpu) * 1000;
    377395        else
     
    380398    return (kHz + 999) / 1000;
    381399}
    382 
    383 
    384 RTDECL(uint32_t) RTMpGetMaxFrequency(RTCPUID idCpu)
    385 {
    386     int64_t kHz = rtLinuxSysFsReadIntFile(0, "devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", (int)idCpu);
    387     if (kHz == -1)
    388         kHz = rtMpLinuxGetFrequency(idCpu) * 1000;
    389     return (kHz + 999) / 1000;
    390 }
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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