Re: [ANNOUNCE] cpupowerutils - cpufrequtils extended with quite some features

Yong Zhang
2011-03-12T04:40:10Z

On Sat, Mar 12, 2011 at 12:34:09PM +0800, Yong Zhang wrote:
> On Fri, Mar 11, 2011 at 12:46:59PM +0100, Thomas Renninger wrote:
> > Happy testing..., if you have a recent machine, you'll like it!
> >
> > After some testing phase it would be great to get this tool
> > merged into the kernel git repo under:
> > tools/power/cpupower
> > and replace the Intel HW only supporting tools in tools/power/x86.
>
> I got below output on my laptop:
>
> |Mperf || Idle_Stats
> CPU | C0 | Cx | Freq || POLL | C1 | C2 | C3
> 0| 36.00| 64.00| 820||1843411670376227.2|1843411670376692.2| 0.00| 0.00
> 1| 44.69| 55.31| 920|| 0.00| 0.00| 0.00| 0.00
>
> Seems below patch fix it:

forget the declaration of value :)

---
--- utils/helpers/sysfs-orig.c 2011-03-12 12:32:06.179827929 +0800
+++ utils/helpers/sysfs.c 2011-03-12 12:35:21.512796546 +0800
@@ -111,7 +111,7 @@
unsigned int idlestate,
enum idlestate_value which)
{
- unsigned long value;
+ unsigned long long value;
unsigned int len;
char linebuf[MAX_LINE_LEN];
char *endp;
@@ -126,7 +126,7 @@
return 0;
}

- value = strtoul(linebuf, &endp, 0);
+ value = strtoull(linebuf, &endp, 0);

if ( endp == linebuf || errno == ERANGE )
return 0;