cpufreq-set
cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
driver: acpi-cpufreq
CPUs which run at the same hardware frequency: 0 1
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 10.0 us.
hardware limits: 2.00 GHz - 2.66 GHz
available frequency steps: 2.66 GHz, 2.00 GHz
available cpufreq governors: userspace, powersave, ondemand, performance
current policy: frequency should be within 2.00 GHz and 2.66 GHz.
The governor "userspace" may decide which speed to use
within this range.
current CPU frequency is 2.66 GHz (asserted by call to hardware).
analyzing CPU 1:
driver: acpi-cpufreq
CPUs which run at the same hardware frequency: 0 1
CPUs which need to have their frequency coordinated by software: 1
maximum transition latency: 10.0 us.
hardware limits: 2.00 GHz - 2.66 GHz
available frequency steps: 2.66 GHz, 2.00 GHz
available cpufreq governors: userspace, powersave, ondemand, performance
current policy: frequency should be within 2.00 GHz and 2.66 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 2.66 GHz (asserted by call to hardware).
Для теста с помощью cpufreq-set меняю туда-сюда частоту, выхлоп cpufreq-info отражается соответствующие изменения, но в реальности частота не меняется:
#include <stdio.h>
#include <sys/time.h>
#include <string.h>
#include <stdint.h>
static uint64_t rdtsc(void)
{
uint32_t a, d;
asm("cpuid");
asm volatile("rdtsc" : "=a" (a), "=d" (d));
return ((uint64_t)(a) | ((uint64_t)d << 32));
}
int main()
{
struct timezone tz;
struct timeval starttime, stoptime;
uint64_t startticks,endticks;
uint32_t msec;
int mhz;
memset(&tz, 0, sizeof(tz));
startticks = rdtsc();
gettimeofday(&starttime, &tz);
usleep(500000);
endticks = rdtsc();
gettimeofday(&stoptime, &tz);
msec = ((stoptime.tv_sec-starttime.tv_sec)*1000000) + (stoptime.tv_usec-starttime.tv_usec);
mhz = (endticks-startticks) / msec;
printf("current speed is %i MHz\n",mhz);
return 0;
}
Что я делаю не так?