22 #include <sys/types.h>
27 #define MSR_IA32_PERF_STATUS 0x198
29 static int rdmsr(
unsigned int cpu,
unsigned int msr,
30 unsigned int *lo,
unsigned int *hi)
34 unsigned long long val;
42 sprintf(file,
"/dev/cpu/%d/msr", cpu);
51 if (
read(fd, &val, 8) != 8)
54 *lo = (
uint32_t )(val & 0xffffffffull);
55 *hi = (
uint32_t )(val>>32 & 0xffffffffull);
64 static void decode (
unsigned int msr)
66 unsigned int multiplier;
69 multiplier = ((msr >> 8) & 0xFF);
71 mv = (((msr & 0xFF) * 16) + 700);
73 printf(
"0x%x means multiplier %d @ %d mV\n", msr, multiplier, mv);
76 static int decode_live(
unsigned int cpu)
84 printf(
"can't get MSR_IA32_PERF_STATUS for cpu %d\n", cpu);
85 printf(
"Possible trouble: you don't run an Enhanced SpeedStep capable cpu\n");
86 printf(
"or you are not root, or the msr driver is not present\n");
102 cpu = strtoul(argv[1],
NULL, 0);