aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuukka Tikkanen <tuukka.tikkanen@linaro.org>2014-12-17 14:43:32 +0200
committerTuukka Tikkanen <tuukka.tikkanen@linaro.org>2014-12-29 10:16:53 +0200
commit88ac29328fd2f70196d261d01958e15762d36f89 (patch)
treed7981c9dbaea8dfdaf098853a5058025eae20c1b
parentd2406bff82715a0778cf594a53654c4d8fbfe7b8 (diff)
Reports: Add support for baseline c- and p-states in display_*states
The functions display_cstates and display_pstates are in control of dumping c/p state information for each cpu. This patch adds handling of baseline states to both functions. If the selected report mode does not provide baseline handling function(s), the operation is silently skipped. Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
-rw-r--r--idlestat.c24
-rw-r--r--report_ops.h2
2 files changed, 22 insertions, 4 deletions
diff --git a/idlestat.c b/idlestat.c
index 3fba423..2edf5ef 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -115,11 +115,16 @@ static int display_cstates(struct report_ops *ops, void *arg, void *baseline, ch
int i;
bool cpu_header = false;
struct cpuidle_cstates *cstates = arg;
+ struct cpuidle_cstates *base_cstates = baseline;
for (i = 0; i < cstates->cstate_max + 1; i++) {
- struct cpuidle_cstate *c = &cstates->cstate[i];
+ struct cpuidle_cstate *c;
+ struct cpuidle_cstate *b;
+
+ c = cstates->cstate + i;
+ b = base_cstates ? base_cstates->cstate + i : NULL;
- if (c->nrdata == 0)
+ if (c->nrdata == 0 && (!b || b->nrdata == 0))
/* nothing to report for this state */
continue;
@@ -128,6 +133,9 @@ static int display_cstates(struct report_ops *ops, void *arg, void *baseline, ch
cpu_header = true;
}
+ if (b && ops->cstate_baseline_state)
+ ops->cstate_baseline_state(b, report_data);
+
ops->cstate_single_state(c, report_data);
}
if (cpu_header)
@@ -141,12 +149,17 @@ static int display_pstates(struct report_ops *ops, void *arg, void *baseline, ch
int i;
bool cpu_header = false;
struct cpufreq_pstates *pstates = arg;
+ struct cpufreq_pstates *base_pstates = baseline;
for (i = 0; i < pstates->max; i++) {
- struct cpufreq_pstate *p = &(pstates->pstate[i]);
+ struct cpufreq_pstate *p;
+ struct cpufreq_pstate *b;
- if (p->count == 0)
+ p = pstates->pstate + i;
+ b = base_pstates ? base_pstates->pstate + i : NULL;
+
+ if (p->count == 0 && (!b || b->count == 0))
/* nothing to report for this state */
continue;
@@ -155,6 +168,9 @@ static int display_pstates(struct report_ops *ops, void *arg, void *baseline, ch
cpu_header = true;
}
+ if (b && ops->pstate_baseline_freq)
+ ops->pstate_baseline_freq(b, report_data);
+
ops->pstate_single_freq(p, report_data);
}
diff --git a/report_ops.h b/report_ops.h
index fcc5e49..7abbd06 100644
--- a/report_ops.h
+++ b/report_ops.h
@@ -17,12 +17,14 @@ struct report_ops {
void (*cstate_table_header)(void *);
void (*cstate_table_footer)(void *);
void (*cstate_cpu_header)(const char *cpu, void *);
+ void (*cstate_baseline_state)(struct cpuidle_cstate*, void *);
void (*cstate_single_state)(struct cpuidle_cstate*, void *);
void (*cstate_end_cpu)(void *);
void (*pstate_table_header)(void *);
void (*pstate_table_footer)(void *);
void (*pstate_cpu_header)(const char *cpu, void *);
+ void (*pstate_baseline_freq)(struct cpufreq_pstate*, void *);
void (*pstate_single_freq)(struct cpufreq_pstate*, void *);
void (*pstate_end_cpu)(void*);