aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuukka Tikkanen <tuukka.tikkanen@linaro.org>2015-01-21 00:47:47 +0200
committerTuukka Tikkanen <tuukka.tikkanen@linaro.org>2015-01-21 00:47:47 +0200
commit65891f8a8480a8245b3df27ee5ef5b2fc3bfba67 (patch)
tree7804aac3202ddd610c218e15c6b8c4b6d0f0a0af
parent6751e8c3f3778c971ba777aba2f3719c28211733 (diff)
Energy_model: Add cluster P-state calculation based on trace data
Earlier cluster P-state calculation for energy model was based on a very simple guess (longest duration of any contained CPU). This patch changes the calculation to be based on actual core or cluster residency at the frequency in question. Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
-rw-r--r--energy_model.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/energy_model.c b/energy_model.c
index 9f15fbc..7965d82 100644
--- a/energy_model.c
+++ b/energy_model.c
@@ -491,18 +491,26 @@ void calculate_energy_consumption(struct cpu_topology *cpu_topo, struct program_
}
}
}
- /*
- * XXX
- * No cluster P-state duration info available yet, so estimate this
- * as the maximum of the durations of its cores at that frequency.
- */
- for (i = 0; i < clustp->number_cap_states; i++) {
- pp = &clustp->p_energy[i];
- cluster_cap += pp->max_core_duration * pp->cluster_power;
- verbose_fprintf(stderr, 1, " P%02d cap estimate for [%7d] | %13.0f | %7d | %7s | %12.0f | %12s | %12s |\n",
- clustp->number_cap_states - i - 1, pp->speed,
- pp->max_core_duration,
+ /* Cluster P-state duration */
+ for (j = 0; j < s_phy->pstates->max; j++) {
+ struct cpufreq_pstate *p = &s_phy->pstates->pstate[j];
+
+ if (p->count == 0)
+ continue;
+
+ pp = find_pstate_energy_info(current_cluster, p->freq/1000);
+ if (!pp) {
+ verbose_fprintf(stderr, 2, "Cluster %c P%-2d no energy model for [%d] (%d hits, %f duration)\n",
+ s_phy->physical_id + 'A', j, p->freq/1000,
+ p->count, p->duration);
+ continue;
+ }
+
+ cluster_cap += p->duration * pp->cluster_power;
+ verbose_fprintf(stderr, 1, "Freq %7u kHz cap estimate for [%7d] | %13.0f | %7d | %7s | %12.0f | %12s | %12s |\n",
+ pp->speed,
+ p->duration,
pp->cluster_power,
"",
cluster_cap,