Commit b37371bf authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

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=47128Signed-off-by: 's avatarMatteo Bruni <mbruni@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d18b5669
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment