aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Bassel <larry.bassel@linaro.org>2015-02-17 15:01:11 -0800
committerAmit Kucheria <amit.kucheria@verdurent.com>2015-03-10 02:04:52 +0530
commit9a52262bf2fe8290c860f13b00c56128de5a5283 (patch)
treeb3f04bdf19bce678e412a8d15ee8b290ddc269e0
parentcd9347fab307f422dc2cbe0e968a81a252a57d1c (diff)
energy_model: calculate number of cap and C states correctly
The number of cap and C states displayed for a cluster in a generated energy model template file was not correct, as these values weren't compatible with the list of cap and C states later in the file. Signed-off-by: Larry Bassel <larry.bassel@linaro.org> Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
-rw-r--r--energy_model.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/energy_model.c b/energy_model.c
index 6931ea4..2ea6fdd 100644
--- a/energy_model.c
+++ b/energy_model.c
@@ -79,8 +79,17 @@ static int make_energy_model_template(struct program_options *options)
s_core = list_entry((&s_phy->core_head)->prev, struct cpu_core, list_core);
s_cpu = list_entry((&s_core->cpu_head)->prev, struct cpu_cpu, list_cpu);
- num_cap_states = s_cpu->pstates->max;
- num_c_states = s_cpu->cstates->cstate_max;
+ num_c_states = s_cpu->cstates->cstate_max + 1;
+ for (i = 0; i < s_cpu->pstates->max; i++) {
+ struct cpufreq_pstate *p = &s_cpu->pstates->pstate[i];
+
+ if (p->freq == 0)
+ continue;
+
+ num_cap_states++;
+ }
+
+ fprintf(f, "\nC-states:\n");
fprintf(f, "cluster%c: %d cap states %d C states\n\n", cluster_number + 'A',
num_cap_states, num_c_states);