On my AMD Turion 64 Mobile ML-40, PowerTop shows C3 as C2, even though it
doesn't support C2, as the code assumes that the C states are contiguous.
$ cat /proc/acpi/processor/C000/power
active state: C0
max_cstate: C8
bus master activity: 00000000
maximum allowed latency: 2000 usec
states:
C1: type[C1] promotion[--] demotion[--] latency[000]
usage[21566331] duration[00000000000000000000]
C2: <not supported>
C3: type[C3] promotion[--] demotion[--] latency[010]
usage[20968443] duration[00000000000478095079]
The patch below (against PowerTop 1.9) parses the C states from the line
instead of assuming they're contiguous.
diff -r fc75a6bb9469 powertop.c
--- a/powertop.c Tue Jan 22 10:14:14 2008 -0800
+++ b/powertop.c Fri Feb 29 10:49:39 2008 -0800
@@ -265,20 +265,26 @@ static void read_data(uint64_t * usage,
memset(line, 0, 4096);
if (fgets(line, 4096, file) == NULL)
break;
+
+ c = strstr(line, "type[");
+ if (!c)
+ continue;
+ c += 5;
+ clevel = c[1] - '0' - 1;
+ if (clevel > maxcstate)
+ maxcstate = clevel;
+
c = strstr(line, "age[");
if (!c)
continue;
c += 4;
usage[clevel] += 1+strtoull(c, NULL, 10);
+
c = strstr(line, "ation[");
if (!c)
continue;
c += 6;
duration[clevel] += strtoull(c, NULL, 10);
-
- clevel++;
- if (clevel > maxcstate)
- maxcstate = clevel;
}
fclose(file);
_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power