mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 00:21:59 +00:00
7ef224d1d0
'hist' triggers allow users to continually aggregate trace events, which can then be viewed afterwards by simply reading a 'hist' file containing the aggregation in a human-readable format. The basic idea is very simple and boils down to a mechanism whereby trace events, rather than being exhaustively dumped in raw form and viewed directly, are automatically 'compressed' into meaningful tables completely defined by the user. This is done strictly via single-line command-line commands and without the aid of any kind of programming language or interpreter. A surprising number of typical use cases can be accomplished by users via this simple mechanism. In fact, a large number of the tasks that users typically do using the more complicated script-based tracing tools, at least during the initial stages of an investigation, can be accomplished by simply specifying a set of keys and values to be used in the creation of a hash table. The Linux kernel trace event subsystem happens to provide an extensive list of keys and values ready-made for such a purpose in the form of the event format files associated with each trace event. By simply consulting the format file for field names of interest and by plugging them into the hist trigger command, users can create an endless number of useful aggregations to help with investigating various properties of the system. See Documentation/trace/events.txt for examples. hist triggers are implemented on top of the existing event trigger infrastructure, and as such are consistent with the existing triggers from a user's perspective as well. The basic syntax follows the existing trigger syntax. Users start an aggregation by writing a 'hist' trigger to the event of interest's trigger file: # echo hist:keys=xxx [ if filter] > event/trigger Once a hist trigger has been set up, by default it continually aggregates every matching event into a hash table using the event key and a value field named 'hitcount'. To view the aggregation at any point in time, simply read the 'hist' file in the same directory as the 'trigger' file: # cat event/hist The detailed syntax provides additional options for user control, and is described exhaustively in Documentation/trace/events.txt and in the virtual tracing/README file in the tracing subsystem. Link: http://lkml.kernel.org/r/72d263b5e1853fe9c314953b65833c3aa75479f2.1457029949.git.tom.zanussi@linux.intel.com Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
73 lines
2.4 KiB
Makefile
73 lines
2.4 KiB
Makefile
|
|
# Do not instrument the tracer itself:
|
|
|
|
ifdef CONFIG_FUNCTION_TRACER
|
|
ORIG_CFLAGS := $(KBUILD_CFLAGS)
|
|
KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS))
|
|
|
|
ifdef CONFIG_FTRACE_SELFTEST
|
|
# selftest needs instrumentation
|
|
CFLAGS_trace_selftest_dynamic.o = $(CC_FLAGS_FTRACE)
|
|
obj-y += trace_selftest_dynamic.o
|
|
endif
|
|
endif
|
|
|
|
# If unlikely tracing is enabled, do not trace these files
|
|
ifdef CONFIG_TRACING_BRANCHES
|
|
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
|
|
endif
|
|
|
|
CFLAGS_trace_benchmark.o := -I$(src)
|
|
CFLAGS_trace_events_filter.o := -I$(src)
|
|
|
|
obj-$(CONFIG_TRACE_CLOCK) += trace_clock.o
|
|
|
|
obj-$(CONFIG_FUNCTION_TRACER) += libftrace.o
|
|
obj-$(CONFIG_RING_BUFFER) += ring_buffer.o
|
|
obj-$(CONFIG_RING_BUFFER_BENCHMARK) += ring_buffer_benchmark.o
|
|
|
|
obj-$(CONFIG_TRACING) += trace.o
|
|
obj-$(CONFIG_TRACING) += trace_output.o
|
|
obj-$(CONFIG_TRACING) += trace_seq.o
|
|
obj-$(CONFIG_TRACING) += trace_stat.o
|
|
obj-$(CONFIG_TRACING) += trace_printk.o
|
|
obj-$(CONFIG_TRACING_MAP) += tracing_map.o
|
|
obj-$(CONFIG_CONTEXT_SWITCH_TRACER) += trace_sched_switch.o
|
|
obj-$(CONFIG_FUNCTION_TRACER) += trace_functions.o
|
|
obj-$(CONFIG_IRQSOFF_TRACER) += trace_irqsoff.o
|
|
obj-$(CONFIG_PREEMPT_TRACER) += trace_irqsoff.o
|
|
obj-$(CONFIG_SCHED_TRACER) += trace_sched_wakeup.o
|
|
obj-$(CONFIG_NOP_TRACER) += trace_nop.o
|
|
obj-$(CONFIG_STACK_TRACER) += trace_stack.o
|
|
obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o
|
|
obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += trace_functions_graph.o
|
|
obj-$(CONFIG_TRACE_BRANCH_PROFILING) += trace_branch.o
|
|
obj-$(CONFIG_BLK_DEV_IO_TRACE) += blktrace.o
|
|
ifeq ($(CONFIG_BLOCK),y)
|
|
obj-$(CONFIG_EVENT_TRACING) += blktrace.o
|
|
endif
|
|
obj-$(CONFIG_EVENT_TRACING) += trace_events.o
|
|
obj-$(CONFIG_EVENT_TRACING) += trace_export.o
|
|
obj-$(CONFIG_FTRACE_SYSCALLS) += trace_syscalls.o
|
|
ifeq ($(CONFIG_PERF_EVENTS),y)
|
|
obj-$(CONFIG_EVENT_TRACING) += trace_event_perf.o
|
|
endif
|
|
obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
|
|
obj-$(CONFIG_EVENT_TRACING) += trace_events_trigger.o
|
|
obj-$(CONFIG_HIST_TRIGGERS) += trace_events_hist.o
|
|
obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o
|
|
obj-$(CONFIG_KPROBE_EVENT) += trace_kprobe.o
|
|
obj-$(CONFIG_TRACEPOINTS) += power-traces.o
|
|
ifeq ($(CONFIG_PM),y)
|
|
obj-$(CONFIG_TRACEPOINTS) += rpm-traces.o
|
|
endif
|
|
ifeq ($(CONFIG_TRACING),y)
|
|
obj-$(CONFIG_KGDB_KDB) += trace_kdb.o
|
|
endif
|
|
obj-$(CONFIG_PROBE_EVENTS) += trace_probe.o
|
|
obj-$(CONFIG_UPROBE_EVENT) += trace_uprobe.o
|
|
|
|
obj-$(CONFIG_TRACEPOINT_BENCHMARK) += trace_benchmark.o
|
|
|
|
libftrace-y := ftrace.o
|