ntdll: Don't read current CPU frequency on Linux.
On the Linux boxes I tested, reading scaling_cur_freq usually takes about 12 ms per core. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47128 Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d18b566995
commit
b37371bf20
|
@ -2907,11 +2907,12 @@ NTSTATUS WINAPI NtPowerInformation( POWER_INFORMATION_LEVEL level, void *input,
|
|||
FILE* f;
|
||||
|
||||
for(i = 0; i < out_cpus; i++) {
|
||||
sprintf(filename, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", i);
|
||||
sprintf(filename, "/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", i);
|
||||
f = fopen(filename, "r");
|
||||
if (f && (fscanf(f, "%d", &cpu_power[i].CurrentMhz) == 1)) {
|
||||
cpu_power[i].CurrentMhz /= 1000;
|
||||
if (f && (fscanf(f, "%d", &cpu_power[i].MaxMhz) == 1)) {
|
||||
cpu_power[i].MaxMhz /= 1000;
|
||||
fclose(f);
|
||||
cpu_power[i].CurrentMhz = cpu_power[i].MaxMhz;
|
||||
}
|
||||
else {
|
||||
if(i == 0) {
|
||||
|
@ -2921,16 +2922,6 @@ NTSTATUS WINAPI NtPowerInformation( POWER_INFORMATION_LEVEL level, void *input,
|
|||
}
|
||||
else
|
||||
cpu_power[i].CurrentMhz = cpu_power[0].CurrentMhz;
|
||||
if(f) fclose(f);
|
||||
}
|
||||
|
||||
sprintf(filename, "/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", i);
|
||||
f = fopen(filename, "r");
|
||||
if (f && (fscanf(f, "%d", &cpu_power[i].MaxMhz) == 1)) {
|
||||
cpu_power[i].MaxMhz /= 1000;
|
||||
fclose(f);
|
||||
}
|
||||
else {
|
||||
cpu_power[i].MaxMhz = cpu_power[i].CurrentMhz;
|
||||
if(f) fclose(f);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue