x86, bts, ftrace: a BTS ftrace plug-in prototype

Impact: add new ftrace plugin

A prototype for a BTS ftrace plug-in.

The tracer collects branch trace in a cyclic buffer for each cpu.

The tracer is not configurable and the trace for each snapshot is
appended when doing cat /debug/tracing/trace.

This is a proof of concept that will be extended with future patches
to become a (hopefully) useful tool.

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Markus Metzger 2008-11-25 09:24:15 +01:00 committed by Ingo Molnar
parent 8bba1bf5e2
commit 1e9b51c283
5 changed files with 301 additions and 0 deletions

View file

@ -27,6 +27,7 @@ enum trace_type {
TRACE_BOOT_RET,
TRACE_FN_RET,
TRACE_USER_STACK,
TRACE_BTS,
__TRACE_LAST_TYPE
};
@ -153,6 +154,12 @@ struct trace_branch {
char correct;
};
struct bts_entry {
struct trace_entry ent;
unsigned long from;
unsigned long to;
};
/*
* trace_flag_type is an enumeration that holds different
* states when a trace occurs. These are:
@ -258,6 +265,7 @@ extern void __ftrace_bad_type(void);
IF_ASSIGN(var, ent, struct trace_boot_ret, TRACE_BOOT_RET);\
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);\
__ftrace_bad_type(); \
} while (0)
@ -392,6 +400,10 @@ void trace_function(struct trace_array *tr,
void
trace_function_return(struct ftrace_retfunc *trace);
void trace_bts(struct trace_array *tr,
unsigned long from,
unsigned long to);
void tracing_start_cmdline_record(void);
void tracing_stop_cmdline_record(void);
void tracing_sched_switch_assign_trace(struct trace_array *tr);