forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'tracing-for-linus' of git://git.kernel.org/pub/scm/linu…
…x/kernel/git/tip/linux-2.6-tip * 'tracing-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (244 commits) Revert "x86, bts: reenable ptrace branch trace support" tracing: do not translate event helper macros in print format ftrace/documentation: fix typo in function grapher name tracing/events: convert block trace points to TRACE_EVENT(), fix !CONFIG_BLOCK tracing: add protection around module events unload tracing: add trace_seq_vprint interface tracing: fix the block trace points print size tracing/events: convert block trace points to TRACE_EVENT() ring-buffer: fix ret in rb_add_time_stamp ring-buffer: pass in lockdep class key for reader_lock tracing: add annotation to what type of stack trace is recorded tracing: fix multiple use of __print_flags and __print_symbolic tracing/events: fix output format of user stack tracing/events: fix output format of kernel stack tracing/trace_stack: fix the number of entries in the header ring-buffer: discard timestamps that are at the start of the buffer ring-buffer: try to discard unneeded timestamps ring-buffer: fix bug in ring_buffer_discard_commit ftrace: do not profile functions when disabled tracing: make trace pipe recognize latency format flag ...
- Loading branch information
Showing
130 changed files
with
8,926 additions
and
2,919 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | ||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> | ||
|
||
<book id="Tracepoints"> | ||
<bookinfo> | ||
<title>The Linux Kernel Tracepoint API</title> | ||
|
||
<authorgroup> | ||
<author> | ||
<firstname>Jason</firstname> | ||
<surname>Baron</surname> | ||
<affiliation> | ||
<address> | ||
<email>[email protected]</email> | ||
</address> | ||
</affiliation> | ||
</author> | ||
</authorgroup> | ||
|
||
<legalnotice> | ||
<para> | ||
This documentation is free software; you can redistribute | ||
it and/or modify it under the terms of the GNU General Public | ||
License as published by the Free Software Foundation; either | ||
version 2 of the License, or (at your option) any later | ||
version. | ||
</para> | ||
|
||
<para> | ||
This program is distributed in the hope that it will be | ||
useful, but WITHOUT ANY WARRANTY; without even the implied | ||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
See the GNU General Public License for more details. | ||
</para> | ||
|
||
<para> | ||
You should have received a copy of the GNU General Public | ||
License along with this program; if not, write to the Free | ||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
MA 02111-1307 USA | ||
</para> | ||
|
||
<para> | ||
For more details see the file COPYING in the source | ||
distribution of Linux. | ||
</para> | ||
</legalnotice> | ||
</bookinfo> | ||
|
||
<toc></toc> | ||
<chapter id="intro"> | ||
<title>Introduction</title> | ||
<para> | ||
Tracepoints are static probe points that are located in strategic points | ||
throughout the kernel. 'Probes' register/unregister with tracepoints | ||
via a callback mechanism. The 'probes' are strictly typed functions that | ||
are passed a unique set of parameters defined by each tracepoint. | ||
</para> | ||
|
||
<para> | ||
From this simple callback mechanism, 'probes' can be used to profile, debug, | ||
and understand kernel behavior. There are a number of tools that provide a | ||
framework for using 'probes'. These tools include Systemtap, ftrace, and | ||
LTTng. | ||
</para> | ||
|
||
<para> | ||
Tracepoints are defined in a number of header files via various macros. Thus, | ||
the purpose of this document is to provide a clear accounting of the available | ||
tracepoints. The intention is to understand not only what tracepoints are | ||
available but also to understand where future tracepoints might be added. | ||
</para> | ||
|
||
<para> | ||
The API presented has functions of the form: | ||
<function>trace_tracepointname(function parameters)</function>. These are the | ||
tracepoints callbacks that are found throughout the code. Registering and | ||
unregistering probes with these callback sites is covered in the | ||
<filename>Documentation/trace/*</filename> directory. | ||
</para> | ||
</chapter> | ||
|
||
<chapter id="irq"> | ||
<title>IRQ</title> | ||
!Iinclude/trace/events/irq.h | ||
</chapter> | ||
|
||
</book> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
Event Tracing | ||
|
||
Documentation written by Theodore Ts'o | ||
Updated by Li Zefan | ||
|
||
1. Introduction | ||
=============== | ||
|
||
Tracepoints (see Documentation/trace/tracepoints.txt) can be used | ||
without creating custom kernel modules to register probe functions | ||
using the event tracing infrastructure. | ||
|
||
Not all tracepoints can be traced using the event tracing system; | ||
the kernel developer must provide code snippets which define how the | ||
tracing information is saved into the tracing buffer, and how the | ||
tracing information should be printed. | ||
|
||
2. Using Event Tracing | ||
====================== | ||
|
||
2.1 Via the 'set_event' interface | ||
--------------------------------- | ||
|
||
The events which are available for tracing can be found in the file | ||
/debug/tracing/available_events. | ||
|
||
To enable a particular event, such as 'sched_wakeup', simply echo it | ||
to /debug/tracing/set_event. For example: | ||
|
||
# echo sched_wakeup >> /debug/tracing/set_event | ||
|
||
[ Note: '>>' is necessary, otherwise it will firstly disable | ||
all the events. ] | ||
|
||
To disable an event, echo the event name to the set_event file prefixed | ||
with an exclamation point: | ||
|
||
# echo '!sched_wakeup' >> /debug/tracing/set_event | ||
|
||
To disable all events, echo an empty line to the set_event file: | ||
|
||
# echo > /debug/tracing/set_event | ||
|
||
To enable all events, echo '*:*' or '*:' to the set_event file: | ||
|
||
# echo *:* > /debug/tracing/set_event | ||
|
||
The events are organized into subsystems, such as ext4, irq, sched, | ||
etc., and a full event name looks like this: <subsystem>:<event>. The | ||
subsystem name is optional, but it is displayed in the available_events | ||
file. All of the events in a subsystem can be specified via the syntax | ||
"<subsystem>:*"; for example, to enable all irq events, you can use the | ||
command: | ||
|
||
# echo 'irq:*' > /debug/tracing/set_event | ||
|
||
2.2 Via the 'enable' toggle | ||
--------------------------- | ||
|
||
The events available are also listed in /debug/tracing/events/ hierarchy | ||
of directories. | ||
|
||
To enable event 'sched_wakeup': | ||
|
||
# echo 1 > /debug/tracing/events/sched/sched_wakeup/enable | ||
|
||
To disable it: | ||
|
||
# echo 0 > /debug/tracing/events/sched/sched_wakeup/enable | ||
|
||
To enable all events in sched subsystem: | ||
|
||
# echo 1 > /debug/tracing/events/sched/enable | ||
|
||
To eanble all events: | ||
|
||
# echo 1 > /debug/tracing/events/enable | ||
|
||
When reading one of these enable files, there are four results: | ||
|
||
0 - all events this file affects are disabled | ||
1 - all events this file affects are enabled | ||
X - there is a mixture of events enabled and disabled | ||
? - this file does not affect any event | ||
|
||
3. Defining an event-enabled tracepoint | ||
======================================= | ||
|
||
See The example provided in samples/trace_events | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
The power tracer collects detailed information about C-state and P-state | ||
transitions, instead of just looking at the high-level "average" | ||
information. | ||
|
||
There is a helper script found in scrips/tracing/power.pl in the kernel | ||
sources which can be used to parse this information and create a | ||
Scalable Vector Graphics (SVG) picture from the trace data. | ||
|
||
To use this tracer: | ||
|
||
echo 0 > /sys/kernel/debug/tracing/tracing_enabled | ||
echo power > /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/tracing/power.pl > out.sv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.