Re: [PATCH RESEND] tools: add power/x86/turbostat - v2

From: Andreas Herrmann
Date: Tue Nov 16 2010 - 05:29:27 EST


On Mon, Nov 15, 2010 at 11:01:05AM -0500, Len Brown wrote:
> From: Len Brown <len.brown@xxxxxxxxx>
>
> turbostat displays actual processor frequency on modern
> Intel processors. Note that this capability depends on free-running
> APERF and MPERF MSRs, which were cleared by the acpi_cpufreq
> driver up through Linux-2.6.29.

Why isn't cpufreq-aperf sufficient for showing the actual frequency?
The tool can handle both AMD and Intel CPUs.

There is a CPUID flag which can be checked for APERF/MPERF existence,
no need to enforce a general vendor check like this:

$ ./turbostat
CPUID: AuthenticAMD != GenuineIntel

> On Intel Core i3/i5/i7 (Nehalem) and newer processors,
> turbostat displays residency in idle power saving states.

Can't this be added to cpuidle-info (see branch cpupowerutils in
git://git.kernel.org/pub/scm/utils/kernel/cpufreq/cpufrequtils.git)?

BTW, gcc v4.4 throws several warnings when compiling your
code:

linux-2.6/tools/power/x86/turbostat $ make
cc -Wall turbostat.c -o turbostat
turbostat.c: In function âget_msrâ:
turbostat.c:234: warning: implicit declaration of function âpreadâ
turbostat.c:237: warning: format â%xâ expects type âunsigned intâ, but argument 4 has type âoff_tâ
turbostat.c:237: warning: format â%dâ expects type âintâ, but argument 5 has type âssize_tâ
turbostat.c: In function âprint_countersâ:
turbostat.c:368: warning: unused variable âiâ
turbostat.c: In function âcompute_averageâ:
turbostat.c:508: warning: unused variable âiâ
turbostat.c: In function âinsert_cpu_countersâ:
turbostat.c:642: warning: unused variable ânextâ
turbostat.c: In function âre_initializeâ:
turbostat.c:747: warning: implicit declaration of function âfor_all_cpusâ
turbostat.c: In function âturbostat_loopâ:
turbostat.c:779: warning: unused variable âretvalâ
turbostat.c: In function âcheck_cpuidâ:
turbostat.c:868: warning: format â%.4sâ expects type âchar *â, but argument 3 has type âunsigned int *â
turbostat.c:868: warning: format â%.4sâ expects type âchar *â, but argument 4 has type âunsigned int *â
turbostat.c:868: warning: format â%.4sâ expects type âchar *â, but argument 5 has type âunsigned int *â
turbostat.c:870: warning: implicit declaration of function âstrncmpâ
turbostat.c: At top level:
turbostat.c:912: warning: return type defaults to âintâ
turbostat.c: In function âdir_filterâ:
turbostat.c:957: warning: implicit declaration of function âisdigitâ
turbostat.c: In function âturbostat_initâ:
turbostat.c:1004: warning: unused variable âiâ
turbostat.c: In function âfork_itâ:
turbostat.c:1038: warning: implicit declaration of function âwaitpidâ
turbostat.c: In function âusageâ:
turbostat.c:915: warning: control reaches end of non-void function
turbostat.c: In function âcompute_deltaâ:
turbostat.c:401: warning: âiâ may be used uninitialized in this function


Regards,
Andreas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/