linux/kernel/trace
Frederic Weisbecker dbd0b4b330 tracing/ftrace: provide the base infrastructure for histogram tracing
Impact: extend the tracing API

The goal of this patch is to normalize and make more easy the
implementation of statistical (histogram) tracing.

It implements a trace_stat file into the /debugfs/tracing directory where
one can print a one-shot output of statistics/histogram entries.

A tracer has to provide two basic iterator callbacks:

  stat_start() => the first entry
  stat_next(prev, idx) => the next one.

Note that it is adapted for arrays or hash tables or lists.... since it
provides a pointer to the previous entry and the current index of the
iterator.

These two callbacks are called to get a snapshot of the statistics at each
opening of the trace_stat file because. The values are so updated between
two "cat trace_stat". And the tracer is free to lock its datas during the
iteration to keep consistent values.

Since it is almost always interesting to sort statisticals values to
address the problems by priority, this infrastructure provides a "sorting"
of the stat entries too if desired. A tracer has just to provide a
stat_cmp callback to compare two entries and the stat tracing
infrastructure will build a sorted list of the given entries.

A last callback, called stat_headers, can be implemented by a tracer to
output headers on its trace.

If one of these callbacks is changed on runtime, it just have to signal it
to the stat tracing API by calling the init_tracer_stat() helper.

Changes in V2:

- Fix a memory leak if the user opens multiple times the trace_stat file
  without closing it. Now we always free our list before rebuilding it.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-12-29 12:55:45 +01:00
..
ftrace.c ftrace: add not to regex on filtering functions 2008-12-18 12:57:09 +01:00
Kconfig trace: add a way to enable or disable the stack tracer 2008-12-18 12:56:24 +01:00
Makefile tracing/ftrace: provide the base infrastructure for histogram tracing 2008-12-29 12:55:45 +01:00
ring_buffer.c ring-buffer: prevent false positive warning 2008-12-23 18:45:26 +01:00
trace_boot.c ftrace: set up trace event hash infrastructure 2008-12-29 12:46:11 +01:00
trace_branch.c ftrace: change trace.c to use registered events 2008-12-29 12:46:12 +01:00
trace_functions_graph.c ftrace: set up trace event hash infrastructure 2008-12-29 12:46:11 +01:00
trace_functions.c ftrace: introduce tracing_reset_online_cpus() helper 2008-12-19 16:29:34 +01:00
trace_hw_branches.c ftrace: set up trace event hash infrastructure 2008-12-29 12:46:11 +01:00
trace_irqsoff.c tracing/ftrace: change the type of the init() callback 2008-11-16 07:55:23 +01:00
trace_mmiotrace.c ftrace: set up trace event hash infrastructure 2008-12-29 12:46:11 +01:00
trace_nop.c tracing/ftrace: make nop tracer using tracer flags 2008-11-18 11:10:59 +01:00
trace_output.c ftrace: change trace.c to use registered events 2008-12-29 12:46:12 +01:00
trace_output.h ftrace: change trace.c to use registered events 2008-12-29 12:46:12 +01:00
trace_power.c ftrace: set up trace event hash infrastructure 2008-12-29 12:46:11 +01:00
trace_sched_switch.c sched, trace: update trace_sched_wakeup() 2008-12-25 13:10:21 +01:00
trace_sched_wakeup.c sched, trace: update trace_sched_wakeup() 2008-12-25 13:10:21 +01:00
trace_selftest_dynamic.c ftrace: fix dynamic ftrace selftest 2008-05-23 21:13:23 +02:00
trace_selftest.c tracing/ftrace: change the type of the init() callback 2008-11-16 07:55:23 +01:00
trace_stack.c trace: better use of stack_trace_enabled for boot up code 2008-12-18 12:56:56 +01:00
trace_stat.c tracing/ftrace: provide the base infrastructure for histogram tracing 2008-12-29 12:55:45 +01:00
trace_sysprof.c ftrace: introduce tracing_reset_online_cpus() helper 2008-12-19 16:29:34 +01:00
trace.c tracing/ftrace: provide the base infrastructure for histogram tracing 2008-12-29 12:55:45 +01:00
trace.h tracing/ftrace: provide the base infrastructure for histogram tracing 2008-12-29 12:55:45 +01:00