aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/trace
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-09 19:39:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-09 19:39:15 -0400
commit214b93132023cc9305d5801add812515bea4d7d0 (patch)
treebb8db8677dd80b6ef570b8aa59475b072b81db11 /Documentation/trace
parent14208b0ec56919f5333dd654b1a7d10765d0ad05 (diff)
parenta9fcaaac37b3baba1343f906f52aeb65c4d4e356 (diff)
Merge tag 'trace-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing updates from Steven Rostedt: "Lots of tweaks, small fixes, optimizations, and some helper functions to help out the rest of the kernel to ease their use of trace events. The big change for this release is the allowing of other tracers, such as the latency tracers, to be used in the trace instances and allow for function or function graph tracing to be in the top level simultaneously" * tag 'trace-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (44 commits) tracing: Fix memory leak on instance deletion tracing: Fix leak of ring buffer data when new instances creation fails tracing/kprobes: Avoid self tests if tracing is disabled on boot up tracing: Return error if ftrace_trace_arrays list is empty tracing: Only calculate stats of tracepoint benchmarks for 2^32 times tracing: Convert stddev into u64 in tracepoint benchmark tracing: Introduce saved_cmdlines_size file tracing: Add __get_dynamic_array_len() macro for trace events tracing: Remove unused variable in trace_benchmark tracing: Eliminate double free on failure of allocation on boot up ftrace/x86: Call text_ip_addr() instead of the duplicated code tracing: Print max callstack on stacktrace bug tracing: Move locking of trace_cmdline_lock into start/stop seq calls tracing: Try again for saved cmdline if failed due to locking tracing: Have saved_cmdlines use the seq_read infrastructure tracing: Add tracepoint benchmark tracepoint tracing: Print nasty banner when trace_printk() is in use tracing: Add funcgraph_tail option to print function name after closing braces tracing: Eliminate duplicate TRACE_GRAPH_PRINT_xx defines tracing: Add __bitmask() macro to trace events to cpumasks and other bitmasks ...
Diffstat (limited to 'Documentation/trace')
-rw-r--r--Documentation/trace/ftrace.txt26
-rw-r--r--Documentation/trace/tracepoints.txt24
2 files changed, 50 insertions, 0 deletions
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt
index bd365988e8d8..2479b2a0c77c 100644
--- a/Documentation/trace/ftrace.txt
+++ b/Documentation/trace/ftrace.txt
@@ -2003,6 +2003,32 @@ want, depending on your needs.
2003 360.774530 | 1) 0.594 us | __phys_addr(); 2003 360.774530 | 1) 0.594 us | __phys_addr();
2004 2004
2005 2005
2006The function name is always displayed after the closing bracket
2007for a function if the start of that function is not in the
2008trace buffer.
2009
2010Display of the function name after the closing bracket may be
2011enabled for functions whose start is in the trace buffer,
2012allowing easier searching with grep for function durations.
2013It is default disabled.
2014
2015 hide: echo nofuncgraph-tail > trace_options
2016 show: echo funcgraph-tail > trace_options
2017
2018 Example with nofuncgraph-tail (default):
2019 0) | putname() {
2020 0) | kmem_cache_free() {
2021 0) 0.518 us | __phys_addr();
2022 0) 1.757 us | }
2023 0) 2.861 us | }
2024
2025 Example with funcgraph-tail:
2026 0) | putname() {
2027 0) | kmem_cache_free() {
2028 0) 0.518 us | __phys_addr();
2029 0) 1.757 us | } /* kmem_cache_free() */
2030 0) 2.861 us | } /* putname() */
2031
2006You can put some comments on specific functions by using 2032You can put some comments on specific functions by using
2007trace_printk() For example, if you want to put a comment inside 2033trace_printk() For example, if you want to put a comment inside
2008the __might_sleep() function, you just have to include 2034the __might_sleep() function, you just have to include
diff --git a/Documentation/trace/tracepoints.txt b/Documentation/trace/tracepoints.txt
index 6b018b53177a..a3efac621c5a 100644
--- a/Documentation/trace/tracepoints.txt
+++ b/Documentation/trace/tracepoints.txt
@@ -115,6 +115,30 @@ If the tracepoint has to be used in kernel modules, an
115EXPORT_TRACEPOINT_SYMBOL_GPL() or EXPORT_TRACEPOINT_SYMBOL() can be 115EXPORT_TRACEPOINT_SYMBOL_GPL() or EXPORT_TRACEPOINT_SYMBOL() can be
116used to export the defined tracepoints. 116used to export the defined tracepoints.
117 117
118If you need to do a bit of work for a tracepoint parameter, and
119that work is only used for the tracepoint, that work can be encapsulated
120within an if statement with the following:
121
122 if (trace_foo_bar_enabled()) {
123 int i;
124 int tot = 0;
125
126 for (i = 0; i < count; i++)
127 tot += calculate_nuggets();
128
129 trace_foo_bar(tot);
130 }
131
132All trace_<tracepoint>() calls have a matching trace_<tracepoint>_enabled()
133function defined that returns true if the tracepoint is enabled and
134false otherwise. The trace_<tracepoint>() should always be within the
135block of the if (trace_<tracepoint>_enabled()) to prevent races between
136the tracepoint being enabled and the check being seen.
137
138The advantage of using the trace_<tracepoint>_enabled() is that it uses
139the static_key of the tracepoint to allow the if statement to be implemented
140with jump labels and avoid conditional branches.
141
118Note: The convenience macro TRACE_EVENT provides an alternative way to 142Note: The convenience macro TRACE_EVENT provides an alternative way to
119 define tracepoints. Check http://lwn.net/Articles/379903, 143 define tracepoints. Check http://lwn.net/Articles/379903,
120 http://lwn.net/Articles/381064 and http://lwn.net/Articles/383362 144 http://lwn.net/Articles/381064 and http://lwn.net/Articles/383362