diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2011-04-19 21:58:59 +0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2011-07-29 20:35:38 +0400 |
commit | b510b54127a4d4112a9a3f200339719bcb463c15 (patch) | |
tree | 172dda3d580231b00b92b19ed41766ec18693739 /tools/power/cpupower/utils/idle_monitor/snb_idle.c | |
parent | 6c2b8185517fea46bdb1e4e70c7005901fcc89ab (diff) | |
download | linux-b510b54127a4d4112a9a3f200339719bcb463c15.tar.xz |
cpupowerutils: idle_monitor - ConfigStyle bugfixes
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'tools/power/cpupower/utils/idle_monitor/snb_idle.c')
-rw-r--r-- | tools/power/cpupower/utils/idle_monitor/snb_idle.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/tools/power/cpupower/utils/idle_monitor/snb_idle.c b/tools/power/cpupower/utils/idle_monitor/snb_idle.c index 8cc80a5b530c..a1bc07cd53e1 100644 --- a/tools/power/cpupower/utils/idle_monitor/snb_idle.c +++ b/tools/power/cpupower/utils/idle_monitor/snb_idle.c @@ -58,11 +58,12 @@ static unsigned long long *current_count[SNB_CSTATE_COUNT]; /* valid flag for all CPUs. If a MSR read failed it will be zero */ static int *is_valid; -static int snb_get_count(enum intel_snb_id id, unsigned long long *val, unsigned int cpu) +static int snb_get_count(enum intel_snb_id id, unsigned long long *val, + unsigned int cpu) { int msr; - switch(id) { + switch (id) { case C7: msr = MSR_CORE_C7_RESIDENCY; break; @@ -91,18 +92,18 @@ static int snb_get_count_percent(unsigned int id, double *percent, if (!is_valid[cpu]) return -1; - *percent = (100.0 * (current_count[id][cpu] - previous_count[id][cpu])) / + *percent = (100.0 * + (current_count[id][cpu] - previous_count[id][cpu])) / (tsc_at_measure_end - tsc_at_measure_start); - dprint("%s: previous: %llu - current: %llu - (%u)\n", snb_cstates[id].name, - previous_count[id][cpu], current_count[id][cpu], - cpu); + dprint("%s: previous: %llu - current: %llu - (%u)\n", + snb_cstates[id].name, previous_count[id][cpu], + current_count[id][cpu], cpu); dprint("%s: tsc_diff: %llu - count_diff: %llu - percent: %2.f (%u)\n", snb_cstates[id].name, (unsigned long long) tsc_at_measure_end - tsc_at_measure_start, - current_count[id][cpu] - - previous_count[id][cpu], + current_count[id][cpu] - previous_count[id][cpu], *percent, cpu); return 0; @@ -141,8 +142,8 @@ static int snb_stop(void) struct cpuidle_monitor intel_snb_monitor; -static struct cpuidle_monitor* snb_register(void) { - +static struct cpuidle_monitor *snb_register(void) +{ int num; if (cpupower_cpu_info.vendor != X86_VENDOR_INTEL @@ -153,12 +154,12 @@ static struct cpuidle_monitor* snb_register(void) { && cpupower_cpu_info.model != 0x2D) return NULL; - is_valid = calloc(cpu_count, sizeof (int)); + is_valid = calloc(cpu_count, sizeof(int)); for (num = 0; num < SNB_CSTATE_COUNT; num++) { - previous_count[num] = calloc (cpu_count, - sizeof(unsigned long long)); - current_count[num] = calloc (cpu_count, - sizeof(unsigned long long)); + previous_count[num] = calloc(cpu_count, + sizeof(unsigned long long)); + current_count[num] = calloc(cpu_count, + sizeof(unsigned long long)); } intel_snb_monitor.name_len = strlen(intel_snb_monitor.name); return &intel_snb_monitor; |