tracing: add "power-tracer": C/P state tracer to help power optimization

Impact: new "power-tracer" ftrace plugin

This patch adds a C/P-state ftrace plugin that will generate
detailed statistics about the C/P-states that are being used,
so that we can look at detailed decisions that the C/P-state
code is making, rather than the too high level "average"
that we have today.

An example way of using this is:

 mount -t debugfs none /sys/kernel/debug
 echo cstate > /sys/kernel/debug/tracing/current_tracer
 echo 1 > /sys/kernel/debug/tracing/tracing_enabled
 sleep 1
 echo 0 > /sys/kernel/debug/tracing/tracing_enabled
 cat /sys/kernel/debug/tracing/trace | perl scripts/trace/cstate.pl > out.svg

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Arjan van de Ven
2008-11-23 16:49:58 -08:00
committed by Ingo Molnar
parent 509dceef64
commit f3f47a6768
8 changed files with 355 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ enum trace_type {
TRACE_FN_RET,
TRACE_USER_STACK,
TRACE_BTS,
TRACE_POWER,
__TRACE_LAST_TYPE
};
@@ -160,6 +161,11 @@ struct bts_entry {
unsigned long to;
};
struct trace_power {
struct trace_entry ent;
struct power_trace state_data;
};
/*
* trace_flag_type is an enumeration that holds different
* states when a trace occurs. These are:
@@ -266,6 +272,7 @@ extern void __ftrace_bad_type(void);
IF_ASSIGN(var, ent, struct trace_branch, TRACE_BRANCH); \
IF_ASSIGN(var, ent, struct ftrace_ret_entry, TRACE_FN_RET);\
IF_ASSIGN(var, ent, struct bts_entry, TRACE_BTS);\
IF_ASSIGN(var, ent, struct trace_power, TRACE_POWER); \
__ftrace_bad_type(); \
} while (0)