aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/trace-cmd-extract.txt66
-rw-r--r--Documentation/trace-cmd-list.txt51
-rw-r--r--Documentation/trace-cmd-listen.txt55
-rw-r--r--Documentation/trace-cmd-record.txt225
-rw-r--r--Documentation/trace-cmd-report.txt285
-rw-r--r--Documentation/trace-cmd-reset.txt54
-rw-r--r--Documentation/trace-cmd-split.txt98
-rw-r--r--Documentation/trace-cmd-start.txt44
-rw-r--r--Documentation/trace-cmd-stop.txt46
-rw-r--r--Documentation/trace-cmd.txt73
10 files changed, 997 insertions, 0 deletions
diff --git a/Documentation/trace-cmd-extract.txt b/Documentation/trace-cmd-extract.txt
new file mode 100644
index 0000000..1eaea3c
--- /dev/null
+++ b/Documentation/trace-cmd-extract.txt
@@ -0,0 +1,66 @@
1TRACE-CMD-EXTRACT(1)
2===================
3
4NAME
5----
6trace-cmd-extract - extract out the data from the Ftrace Linux tracer.
7
8SYNOPSIS
9--------
10*trace-cmd extract ['OPTIONS']*
11
12DESCRIPTION
13-----------
14The trace-cmd(1) extract is usually used after 'trace-cmd-start(1)' and
15'trace-cmd-stop(1)'. It can be used after the Ftrace tracer has been started
16manually through the Ftrace pseudo file system.
17
18The extract command creates a trace.dat file that can be used by
19'trace-cmd-report(1)' to read from. It reads the kernel internal ring buffer
20to produce the trace.dat file.
21
22OPTIONS
23-------
24*-p* 'plugin'::
25 Although *extract* does not start any traces, some of the plugins require
26 just reading the output in ASCII format. These are the latency tracers,
27 since the latency tracers have a separate internal buffer. The plugin
28 option is therefore only necessary for the 'wakeup', 'wakeup-rt',
29 'irqsoff', 'preemptoff' and 'preemptirqsoff' plugins.
30
31 With out this option, the extract command will extract from the internal
32 Ftrace buffers.
33
34*-O* 'option'::
35 If a latency tracer is being extracted, and the *-p* option is used, then
36 there are some Ftrace options that can change the format. This will update
37 those options before extracting. To see the list of options see
38 'trace-cmd-list'. To enable an option, write its name, to disable the
39 option append the characters 'no' to it. For example: 'noprint-parent'
40 will disable the 'print-parent' option that prints the parent function in
41 printing a function event.
42
43*-o* 'outputfile'::
44 By default, the extract command will create a 'trace.dat' file. This
45 option will change where the file is written to.
46
47
48SEE ALSO
49--------
50trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
51trace-cmd-stop(1), trace-cmd-reset(1), trace-cmd-split(1),
52trace-cmd-list(1), trace-cmd-listen(1)
53
54AUTHOR
55------
56Written by Steven Rostedt, <rostedt@goodmis.org>
57
58RESOURCES
59---------
60git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
61
62COPYING
63-------
64Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under
65the terms of the GNU Public License (GPL).
66
diff --git a/Documentation/trace-cmd-list.txt b/Documentation/trace-cmd-list.txt
new file mode 100644
index 0000000..16d0b6b
--- /dev/null
+++ b/Documentation/trace-cmd-list.txt
@@ -0,0 +1,51 @@
1TRACE-CMD-LIST(1)
2==================
3
4NAME
5----
6trace-cmd-list - list available plugins, events or options for Ftrace.
7
8SYNOPSIS
9--------
10*trace-cmd list* ['OPTIONS']
11
12DESCRIPTION
13-----------
14The trace-cmd(1) list displays the available plugins, events or Ftrace options
15that are configured on the current machine. If no option is given, then it
16lists all plugins, events and Ftrace options to standard output.
17
18OPTIONS
19-------
20*-e*::
21 This option will list the available events that are enabled on the
22 local system.
23
24*-p*::
25 This option will list the available plugins that are enabled on the
26 local system.
27
28*-o*::
29 This option will list the available Ftrace options that are configured on
30 the local system.
31
32
33SEE ALSO
34--------
35trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
36trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1),
37trace-cmd-split(1), trace-cmd-listen(1)
38
39AUTHOR
40------
41Written by Steven Rostedt, <rostedt@goodmis.org>
42
43RESOURCES
44---------
45git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
46
47COPYING
48-------
49Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under
50the terms of the GNU Public License (GPL).
51
diff --git a/Documentation/trace-cmd-listen.txt b/Documentation/trace-cmd-listen.txt
new file mode 100644
index 0000000..981fb96
--- /dev/null
+++ b/Documentation/trace-cmd-listen.txt
@@ -0,0 +1,55 @@
1TRACE-CMD-LISTEN(1)
2==================
3
4NAME
5----
6trace-cmd-listen - listen for incoming connection to record tracing.
7
8SYNOPSIS
9--------
10*trace-cmd listen* -p 'port' ['OPTIONS']
11
12DESCRIPTION
13-----------
14The trace-cmd(1) listen sets up a port to listen to waiting for connections
15from other hosts that run 'trace-cmd-record(1)' with the *-N* option. When a
16connection is made, and the remote host sends data, it will create a file
17called 'trace.HOST:PORT.dat'. Where HOST is the name of the remote host, and
18PORT is the port that the remote host used to connect with.
19
20OPTIONS
21-------
22*-p* 'port'::
23 This option will specifies tha port to listen to.
24
25*-D*::
26 This options causes trace-cmd listen to go into a daemon mode and run in
27 the background.
28
29*-d* 'dir'::
30 This option specifies a directory to write the data files into.
31
32*-o* 'filename'::
33 This option overides the default 'trace' in the 'trace.HOST:PORT.dat' that
34 is created when a remote host connects.
35
36
37SEE ALSO
38--------
39trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
40trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1),
41trace-cmd-split(1), trace-cmd-list(1)
42
43AUTHOR
44------
45Written by Steven Rostedt, <rostedt@goodmis.org>
46
47RESOURCES
48---------
49git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
50
51COPYING
52-------
53Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under
54the terms of the GNU Public License (GPL).
55
diff --git a/Documentation/trace-cmd-record.txt b/Documentation/trace-cmd-record.txt
new file mode 100644
index 0000000..9f43d6d
--- /dev/null
+++ b/Documentation/trace-cmd-record.txt
@@ -0,0 +1,225 @@
1TRACE-CMD-RECORD(1)
2===================
3
4NAME
5----
6trace-cmd-record - record a trace from the Ftrace Linux internal tracer
7
8SYNOPSIS
9--------
10*trace-cmd record* ['OPTIONS'] ['command']
11
12DESCRIPTION
13-----------
14The trace-cmd(1) record command will set up the Ftrace Linux kernel tracer to
15record the specified plugins or events that happen while the 'command'
16executes. If no command is given, then it will record until the user hits
17Ctrl-C.
18
19The record command of trace-cmd will set up the Ftrace tracer to start tracing
20the various events or plugins that are given on the command line. It will then
21create a number of tracing processes (one per CPU) that will start recording
22from the kernel ring buffer straight into temporary files. When the command is
23complete (or Ctrl-C is hit) all the files will be combined into a trace.dat
24file that can later be read (see trace-cmd-report(1)).
25
26OPTIONS
27-------
28*-p* 'plugin'::
29 Specify a trace plugin. Plugins are special Ftrace tracers that usually do
30 more than just trace an event. Common plugins are *function*,
31 *function_graph*, *preemptirqsoff*, *irqsoff*, *preemptoff*, and *wakeup*.
32 A plugin must be supported by the running kernel. To see a list of
33 available plugins, see trace-cmd-list(1).
34
35*-e* 'event'::
36 Specify an event to trace. Various static trace points have been added to
37 the Linux kernel. They are grouped by subsystem where you can enable all
38 events of a given subsystem or specify specific events to be enabled. The
39 'event' is of the format "subsystem:event-name". You can also just specify
40 the subsystem without the ':event-name' or the eventname without the
41 "subsystem:". Using "-e sched_switch" will enable the "sched_switch" event
42 where as, "-e sched" will enable all events under the "sched" subsystem.
43
44 The 'event' can also contain glob expressions. That is, "*stat*" will
45 select all events (or subsystems) that have the characters "stat" in their
46 names.
47
48 The keyword 'all' can be used to enable all events.
49
50*-f* 'filter'::
51 Specify a filter for the previous event. This must come after a *-e*. This
52 will filter what events get recorded based on the content of the event.
53 Filtering is passed to the kernel directly so what filtering is allowed
54 may depend on what verison of the kernel you have. Basically, it will
55 let you use C notation to check if an event should be processed or not.
56
57----------------------------------------
58 ==, >=, <=, >, <, &, |, && and ||
59----------------------------------------
60
61 The above are usually safe to use to compare fields.
62
63*-v*::
64 This will cause all events specified after it on the command line to not
65 be traced. This is useful for selecting a subsystem to be traced but to
66 leave out various events. For Example: "-e sched -v -e "\*stat\*"" will
67 enable all events in the sched subsystem except those that have "stat" in
68 their names.
69
70 Note: the *-v* option was taken from the way grep(1) inverts the following
71 matches.
72
73*-F*::
74 This will filter only the executable that is given on the command line. If
75 no command is given, then it will filter itself (pretty pointless).
76 Using *-F* will let you trace only events that are caused by the given
77 command.
78
79*-P* 'pid'::
80 Similar to *-F* but lets you specify a process ID to trace.
81
82*-o* 'output-file'::
83 By default, trace-cmd report will create a 'trace.dat' file. You can
84 specify a different file to write to with the *-o* option.
85
86*-l* 'function-name'::
87 This will limit the 'function' and 'function_graph' tracers to only trace
88 the given function name. More than one *-l* may be specified on the
89 command line to trace more than one function. The limited use of glob
90 expressions are also allowed. These are 'match\*' to only filter functions
91 that start with 'match'. '\*match' to only filter functions that end with
92 'match'. '\*match\*' to only filter on functions that contain 'match'.
93
94*-g* 'function-name'::
95 This option is for the function_graph plugin. It will graph the given
96 function. That is, it will only trace the function and all functions that
97 it calls. You can have more than one *-g* on the command line.
98
99*-n* 'function-name'::
100 This has the opposite effect of *-l*. The function given with the *-n*
101 option will not be traced. This takes precedence, that is, if you include
102 the same function for both *-n* and *-l*, it will not be traced.
103
104*-d*::
105 Some tracer plugins enable the function tracer by default. Like the
106 latency tracers. This option prevents the function tracer from being
107 enabled at start up.
108
109*-O* 'option'::
110 Ftrace has various options that can be enabled or disabled. This allows
111 you to set them. Appending the text 'no' to an option disables it.
112 For example: "-O nograph-time" will disable the "graph-time" Ftrace
113 option.
114
115*-s* 'interval'::
116 The processes that trace-cmd creates to record from the ring buffer need
117 to wake up to do the recording. Setting the 'interval' to zero will cause
118 the processes to wakeup every time new data is written into the buffer.
119 But since Ftrace is recording kernel activity, the act of this processes
120 going back to sleep may cause new events into the ring buffer which will
121 wake the process back up. This will needlessly add extra data into the
122 ring buffer.
123
124 The 'interval' metric is microseconds. The default is set to 1000 (1 ms).
125 This is the time each recording process will sleep before waking up to
126 record any new data that was written to the ring buffer.
127
128*-b* 'size'::
129 This sets the ring buffer size to 'size' kilobytes. Because the Ftrace
130 ring buffer is per CPU, this size is the size of each per CPU ring buffer
131 inside the kernel. Using "-b 10000" on a machine with 4 CPUs will make
132 Ftrace have a total buffer size of 40 Megs.
133
134*-N* 'host:port'::
135 If another machine is running "trace-cmd listen", this option is used to
136 have the data sent to that machine with UDP packets. Instead of writing
137 to an output file, the data is sent off to a remote box. This is ideal for
138 embedded machines with little storage, or having a single machine that
139 will keep all the data in a single repository.
140
141*-t*::
142 This option is used with *-N*, when there's a need to send the live data
143 with TCP packets instead of UDP. Although TCP is not nearly as fast as
144 sending the UDP packets, but it may be needed if the network is not that
145 reliable, the amount of data is not that intensive, and a guarantee is
146 needed that all traced information is transfered successfully.
147
148
149EXAMPLES
150--------
151
152The basic way to trace all events:
153
154------------------------------
155 # trace-cmd record -e all ls > /dev/null
156 # trace-cmd report
157 trace-cmd-13541 [003] 106260.693809: filemap_fault: address=0x128122 offset=0xce
158 trace-cmd-13543 [001] 106260.693809: kmalloc: call_site=81128dd4 ptr=0xffff88003dd83800 bytes_req=768 bytes_alloc=1024 gfp_flags=GFP_KERNEL|GFP_ZERO
159 ls-13545 [002] 106260.693809: kfree: call_site=810a7abb ptr=0x0
160 ls-13545 [002] 106260.693818: sys_exit_write: 0x1
161
162
163------------------------------
164
165
166
167To use the function tracer with sched switch tracing:
168
169------------------------------
170 # trace-cmd record -p function -e sched_switch ls > /dev/null
171 # trace-cmd report
172 ls-13587 [002] 106467.860310: function: hrtick_start_fair <-- pick_next_task_fair
173 ls-13587 [002] 106467.860313: sched_switch: prev_comm=trace-cmd prev_pid=13587 prev_prio=120 prev_state=R ==> next_comm=trace-cmd next_pid=13583 next_prio=120
174 trace-cmd-13585 [001] 106467.860314: function: native_set_pte_at <-- __do_fault
175 trace-cmd-13586 [003] 106467.860314: function: up_read <-- do_page_fault
176 ls-13587 [002] 106467.860317: function: __phys_addr <-- schedule
177 trace-cmd-13585 [001] 106467.860318: function: _raw_spin_unlock <-- __do_fault
178 ls-13587 [002] 106467.860320: function: native_load_sp0 <-- __switch_to
179 trace-cmd-13586 [003] 106467.860322: function: down_read_trylock <-- do_page_fault
180
181
182------------------------------
183
184Here is a nice way to find what interrupts have the highest latency:
185------------------------------------------
186 # trace-cmd record -p function_graph -e irq_handler_entry -l do_IRQ sleep 10
187 # trace-cmd report
188 <idle>-0 [000] 157412.933969: funcgraph_entry: | do_IRQ() {
189 <idle>-0 [000] 157412.933974: irq_handler_entry: irq=48 name=eth0
190 <idle>-0 [000] 157412.934004: funcgraph_exit: + 36.358 us | }
191 <idle>-0 [000] 157413.895004: funcgraph_entry: | do_IRQ() {
192 <idle>-0 [000] 157413.895011: irq_handler_entry: irq=48 name=eth0
193 <idle>-0 [000] 157413.895026: funcgraph_exit: + 24.014 us | }
194 <idle>-0 [000] 157415.891762: funcgraph_entry: | do_IRQ() {
195 <idle>-0 [000] 157415.891769: irq_handler_entry: irq=48 name=eth0
196 <idle>-0 [000] 157415.891784: funcgraph_exit: + 22.928 us | }
197 <idle>-0 [000] 157415.934869: funcgraph_entry: | do_IRQ() {
198 <idle>-0 [000] 157415.934874: irq_handler_entry: irq=48 name=eth0
199 <idle>-0 [000] 157415.934906: funcgraph_exit: + 37.512 us | }
200 <idle>-0 [000] 157417.888373: funcgraph_entry: | do_IRQ() {
201 <idle>-0 [000] 157417.888381: irq_handler_entry: irq=48 name=eth0
202 <idle>-0 [000] 157417.888398: funcgraph_exit: + 25.943 us | }
203
204
205------------------------------------------
206
207SEE ALSO
208--------
209trace-cmd(1), trace-cmd-report(1), trace-cmd-start(1), trace-cmd-stop(1),
210trace-cmd-extract(1), trace-cmd-reset(1), trace-cmd-split(1),
211trace-cmd-list(1), trace-cmd-listen(1)
212
213AUTHOR
214------
215Written by Steven Rostedt, <rostedt@goodmis.org>
216
217RESOURCES
218---------
219git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
220
221COPYING
222-------
223Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under
224the terms of the GNU Public License (GPL).
225
diff --git a/Documentation/trace-cmd-report.txt b/Documentation/trace-cmd-report.txt
new file mode 100644
index 0000000..aa033f5
--- /dev/null
+++ b/Documentation/trace-cmd-report.txt
@@ -0,0 +1,285 @@
1TRACE-CMD-REPORT(1)
2===================
3
4NAME
5----
6trace-cmd-report - show in ASCII a trace created by trace-cmd record
7
8SYNOPSIS
9--------
10*trace-cmd report* ['OPTIONS'] ['input-file']
11
12DESCRIPTION
13-----------
14The trace-cmd(1) report command will output a human readable report of a trace
15created by trace-cmd record.
16
17OPTIONS
18-------
19*-i* 'input-file'::
20 By default, trace-cmd report willl read the file 'trace.dat'. But the *-i*
21 option open up the given 'input-file' instead. Note, the input file may
22 also be specified as the last item on the command line.
23
24*-e*::
25 This outputs the endianess of the file. trace-cmd report is smart enough
26 to be able to read big endian files on little endian machines, and vise
27 versa.
28
29*-f*::
30 This outputs the list of functions that have been recorded in the file.
31
32*-P*::
33 This outputs the list of "trace_printk()" data. The raw trace data points
34 to static pointers in the kernel. This must be stored in the trace.dat
35 file.
36
37*-E*::
38 This lists the possible events in the file (but this list is not
39 necessarily the list of events in the file).
40
41*--events*::
42 This will list the event formats that are stored in the trace.dat file.
43
44*-F* 'filter'::
45 Add a filter to limit what events are displayed. The format of the filter
46 is:
47
48------------------------------------------
49 <events> ':' <filter>
50 <events> = SYSTEM'/'EVENT | SYSTEM | EVENT | <events> ',' <events>
51 <filter> = EVENT_FIELD <op> <value> | <filter> '&&' <filter> |
52 <filter> '||' <filter> | '(' <filter> ')' | '!' <filter>
53 <op> = '==' | '!=' | '>=' | '<=' | '>' | '<' | '&' | '|' | '^' |
54 '+' | '-' | '*' | '/' | '%'
55 <value> = NUM | STRING | EVENT_FIELD
56------------------------------------------
57
58 SYSTEM is the name of the system to filter on. If the EVENT is left out,
59 then it applies to all events under the SYSTEM. If only one string is used
60 without the '/' to deliminate between SYSTEM and EVENT, then the filter
61 will be applied to all systems and events that match the given string.
62
63 Whitespace is ignored, such that "sched:next_pid==123" is equivalent to
64 "sched : next_pid == 123".
65
66 STRING is defined with single or double quotes (single quote must end with
67 single quote, and double with double). Whitespace within quotes are not
68 ignored.
69
70 The representation of a SYSTEM or EVENT may also be a regular expression
71 as defined by 'regcomp(3)'.
72
73 The EVENT_FIELD is the name of the field of an event that is being
74 filtered. If the event does not contain the EVENT_FIELD, that part of the
75 equation will be considered false.
76
77------------------------------------------
78 -F 'sched : bogus == 1 || common_pid == 2'
79------------------------------------------
80
81 The "bogus == 1" will always evaluate to FALSE because no event has a
82 field called "bogus", but the "common_pid == 2" will still be evaluated
83 since all events have the field "common_pid". Any "sched" event that was
84 traced by the process with the PID of 2 will be shown.
85
86 Note, the EVENT_FIELD is the field name as shown by an events format
87 (as displayed with *--events*), and not what is found in the output.
88 If the output shows "ID:foo" but the field that "foo" belongs to was
89 called "name" in the event format, then "name" must be used in the filter.
90 The same is true about values. If the value that is displayed is converted
91 by to a string symbol, the filter checks the original value and not the
92 value displayed. For example, to filter on all tasks that were in the
93 running state at a context switch:
94
95------------------------------------------
96 -F 'sched/sched_switch : prev_state==0'
97------------------------------------------
98
99 Although the output displays 'R', having 'prev_stat=="R"' will not work.
100
101*-v*::
102 This causes the following filters of *-F* to filter out the matching
103 events.
104
105------------------------------------------
106 -v -F 'sched/sched_switch : prev_state == 0'
107------------------------------------------
108
109 Will not display any sched_switch events that have a prev_state of 0.
110 Removing the *-v* will only print out those events.
111
112*-l*::
113 This adds a "latency output" format. Information about interrupts being
114 disabled, soft irq being disabled, the "need_resched" flag being set,
115 preempt count, and big kernel lock are all being recorded with every
116 event. But the default display does not show this information. This option
117 will set display this information with 6 characters. When one of the
118 fields is zero or N/A a \'.\' is shown.
119
120------------------------------------------
121 <idle>-0 0d.h1. 106467.859747: function: ktime_get <-- tick_check_idle
122------------------------------------------
123
124 The 0d.h1. denotes this information. The first character is never a '.'
125 and represents what CPU the trace was recorded on (CPU 0). The 'd' denotes
126 that interrupts were disabled. The 'h' means that this was called inside
127 an interrupt handler. The '1' is the preemption disabled (preempt_count)
128 was set to one. The two '.'s are "need_resched" flag and kernel lock
129 counter. If the "need_resched" flag is set, then that charater would be a
130 'N'.
131
132*-w*::
133 If both the 'sched_switch' and 'sched_wakeup' events are enabled, then
134 this option will report the latency between the time the task was first
135 woken, and the time it was scheduled in.
136
137EXAMPLES
138--------
139
140Using a trace.dat file that was created with:
141
142------------------------------------------
143 # trace-cmd record -p function -e all sleep 5
144
145
146------------------------------------------
147
148The default report shows:
149
150------------------------------------------
151 # trace-cmd report
152 trace-cmd-16129 [002] 158126.498411: function: __mutex_unlock_slowpath <-- mutex_unlock
153 trace-cmd-16131 [000] 158126.498411: kmem_cache_alloc: call_site=811223c5 ptr=0xffff88003ecf2b40 bytes_req=272 bytes_alloc=320 gfp_flags=GFP_KERNEL|GFP_ZERO
154 trace-cmd-16130 [003] 158126.498411: function: do_splice_to <-- sys_splice
155 sleep-16133 [001] 158126.498412: function: inotify_inode_queue_event <-- vfs_write
156 trace-cmd-16129 [002] 158126.498420: lock_release: 0xffff88003f1fa4f8 &sb->s_type->i_mutex_key
157 trace-cmd-16131 [000] 158126.498421: function: security_file_alloc <-- get_empty_filp
158 sleep-16133 [001] 158126.498422: function: __fsnotify_parent <-- vfs_write
159 trace-cmd-16130 [003] 158126.498422: function: rw_verify_area <-- do_splice_to
160 trace-cmd-16131 [000] 158126.498424: function: cap_file_alloc_security <-- security_file_alloc
161 trace-cmd-16129 [002] 158126.498425: function: syscall_trace_leave <-- int_check_syscall_exit_work
162 sleep-16133 [001] 158126.498426: function: inotify_dentry_parent_queue_event <-- vfs_write
163 trace-cmd-16130 [003] 158126.498426: function: security_file_permission <-- rw_verify_area
164 trace-cmd-16129 [002] 158126.498428: function: audit_syscall_exit <-- syscall_trace_leave
165[...]
166
167
168------------------------------------------
169
170To see everything but the function traces:
171
172------------------------------------------
173 # trace-cmd report -v -F 'function'
174 trace-cmd-16131 [000] 158126.498411: kmem_cache_alloc: call_site=811223c5 ptr=0xffff88003ecf2b40 bytes_req=272 bytes_alloc=320 gfp_flags=GFP_KERNEL|GFP_ZERO
175 trace-cmd-16129 [002] 158126.498420: lock_release: 0xffff88003f1fa4f8 &sb->s_type->i_mutex_key
176 trace-cmd-16130 [003] 158126.498436: lock_acquire: 0xffffffff8166bf78 read all_cpu_access_lock
177 trace-cmd-16131 [000] 158126.498438: lock_acquire: 0xffff88003df5b520 read &fs->lock
178 trace-cmd-16129 [002] 158126.498446: kfree: call_site=810a7abb ptr=0x0
179 trace-cmd-16130 [003] 158126.498448: lock_acquire: 0xffff880002250a80 &per_cpu(cpu_access_lock, cpu)
180 trace-cmd-16129 [002] 158126.498450: sys_exit_splice: 0xfffffff5
181 trace-cmd-16131 [000] 158126.498454: lock_release: 0xffff88003df5b520 &fs->lock
182 sleep-16133 [001] 158126.498456: kfree: call_site=810a7abb ptr=0x0
183 sleep-16133 [001] 158126.498460: sys_exit_write: 0x1
184 trace-cmd-16130 [003] 158126.498462: kmalloc: call_site=810bf95b ptr=0xffff88003dedc040 bytes_req=24 bytes_alloc=32 gfp_flags=GFP_KERNEL|GFP_ZERO
185
186
187------------------------------------------
188
189To see only the kmalloc calls that were greater than 1000 bytes:
190
191------------------------------------------
192 #trace-cmd report -F 'kmalloc: bytes_req > 1000'
193 <idle>-0 [000] 158128.126641: kmalloc: call_site=81330635 ptr=0xffff88003c2fd000 bytes_req=2096 bytes_alloc=4096 gfp_flags=GFP_ATOMIC
194
195
196------------------------------------------
197
198To see wakeups and sched switches that left the previous task in the running
199state:
200------------------------------------------
201 # trace-cmd report -F 'sched: prev_state == 0 || (success == 1)'
202 trace-cmd-16132 [002] 158126.499951: sched_wakeup: comm=trace-cmd pid=16129 prio=120 success=1 target_cpu=002
203 trace-cmd-16132 [002] 158126.500401: sched_switch: prev_comm=trace-cmd prev_pid=16132 prev_prio=120 prev_state=R ==> next_comm=trace-cmd next_pid=16129 next_prio=120
204 <idle>-0 [003] 158126.500585: sched_wakeup: comm=trace-cmd pid=16130 prio=120 success=1 target_cpu=003
205 <idle>-0 [003] 158126.501241: sched_switch: prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=trace-cmd next_pid=16130 next_prio=120
206 trace-cmd-16132 [000] 158126.502475: sched_wakeup: comm=trace-cmd pid=16131 prio=120 success=1 target_cpu=000
207 trace-cmd-16131 [002] 158126.506516: sched_wakeup: comm=trace-cmd pid=16129 prio=120 success=1 target_cpu=002
208 <idle>-0 [003] 158126.550110: sched_switch: prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=trace-cmd next_pid=16130 next_prio=120
209 trace-cmd-16131 [003] 158126.570243: sched_wakeup: comm=trace-cmd pid=16129 prio=120 success=1 target_cpu=003
210 trace-cmd-16130 [002] 158126.618202: sched_switch: prev_comm=trace-cmd prev_pid=16130 prev_prio=120 prev_state=R ==> next_comm=yum-updatesd next_pid=3088 next_prio=1 20
211 trace-cmd-16129 [003] 158126.622379: sched_wakeup: comm=trace-cmd pid=16131 prio=120 success=1 target_cpu=003
212 trace-cmd-16129 [000] 158126.649287: sched_wakeup: comm=trace-cmd pid=16131 prio=120 success=1 target_cpu=000
213
214
215------------------------------------------
216
217The above needs a little explanation. The filter specifies the "sched"
218subsystem, which includes both sched_switch and sched_wakeup events. Any event
219that does not have the format field "prev_state" or "success", will evaluate
220those expressions as FALSE, and will not produce a match. Using "||" will have
221the "prev_state" test happen for the "sched_switch" event and the "success"
222test happen for the "sched_wakeup" event.
223
224
225------------------------------------------
226 # trace-cmd report -w -F 'sched_switch, sched_wakeup.*'
227[...]
228 trace-cmd-16130 [003] 158131.580616: sched_wakeup: comm=trace-cmd pid=16131 prio=120 success=1 target_cpu=003
229 trace-cmd-16129 [000] 158131.581502: sched_switch: prev_comm=trace-cmd prev_pid=16129 prev_prio=120 prev_state=S ==> next_comm=trace-cmd next_pid=16131 next_prio=120 Latency: 885.901 usecs
230 trace-cmd-16131 [000] 158131.582414: sched_wakeup: comm=trace-cmd pid=16129 prio=120 success=1 target_cpu=000
231 trace-cmd-16132 [001] 158131.583219: sched_switch: prev_comm=trace-cmd prev_pid=16132 prev_prio=120 prev_state=S ==> next_comm=trace-cmd next_pid=16129 next_prio=120 Latency: 804.809 usecs
232 sleep-16133 [002] 158131.584121: sched_wakeup: comm=trace-cmd pid=16120 prio=120 success=1 target_cpu=002
233 trace-cmd-16129 [001] 158131.584128: sched_wakeup: comm=trace-cmd pid=16132 prio=120 success=1 target_cpu=001
234 sleep-16133 [002] 158131.584275: sched_switch: prev_comm=sleep prev_pid=16133 prev_prio=120 prev_state=R ==> next_comm=trace-cmd next_pid=16120 next_prio=120 Latency: 153.915 usecs
235 trace-cmd-16130 [003] 158131.585284: sched_switch: prev_comm=trace-cmd prev_pid=16130 prev_prio=120 prev_state=S ==> next_comm=trace-cmd next_pid=16132 next_prio=120 Latency: 1155.677 usecs
236
237Average wakeup latency: 26626.656 usecs
238
239
240------------------------------------------
241
242The above trace produces the wakeup latencies of the tasks. The "sched_switch"
243event reports each individual latency after writing the event information.
244At the end of the report, the average wakeup latency is reported.
245
246------------------------------------------
247 # trace-cmd report -w -F 'sched_switch, sched_wakeup.*: prio < 100 || next_prio < 100'
248 <idle>-0 [003] 158131.516753: sched_wakeup: comm=ksoftirqd/3 pid=13 prio=49 success=1 target_cpu=003
249 <idle>-0 [003] 158131.516855: sched_switch: prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=ksoftirqd/3 next_pid=13 next_prio=49 Latency: 101.244 usecs
250 <idle>-0 [003] 158131.533781: sched_wakeup: comm=ksoftirqd/3 pid=13 prio=49 success=1 target_cpu=003
251 <idle>-0 [003] 158131.533897: sched_switch: prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=ksoftirqd/3 next_pid=13 next_prio=49 Latency: 115.608 usecs
252 <idle>-0 [003] 158131.569730: sched_wakeup: comm=ksoftirqd/3 pid=13 prio=49 success=1 target_cpu=003
253 <idle>-0 [003] 158131.569851: sched_switch: prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=ksoftirqd/3 next_pid=13 next_prio=49 Latency: 121.024 usecs
254
255Average wakeup latency: 110.021 usecs
256
257
258------------------------------------------
259
260The above version will only show the wakeups and context switches of Real Time
261tasks. The 'prio' used inside the kernel starts at 0 for highest priority.
262That is 'prio' 0 is equivalent to user space real time priority 99, and
263priority 98 is quivalent to user space real time priority 1.
264Prios less than 100 represent Real Time tasks.
265
266
267SEE ALSO
268--------
269trace-cmd(1), trace-cmd-record(1), trace-cmd-start(1), trace-cmd-stop(1),
270trace-cmd-extract(1), trace-cmd-reset(1), trace-cmd-split(1),
271trace-cmd-list(1), trace-cmd-listen(1)
272
273AUTHOR
274------
275Written by Steven Rostedt, <rostedt@goodmis.org>
276
277RESOURCES
278---------
279git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
280
281COPYING
282-------
283Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under
284the terms of the GNU Public License (GPL).
285
diff --git a/Documentation/trace-cmd-reset.txt b/Documentation/trace-cmd-reset.txt
new file mode 100644
index 0000000..0473e1d
--- /dev/null
+++ b/Documentation/trace-cmd-reset.txt
@@ -0,0 +1,54 @@
1TRACE-CMD-RESET(1)
2==================
3
4NAME
5----
6trace-cmd-reset - turn off all Ftrace tracing to bring back full performance
7
8SYNOPSIS
9--------
10*trace-cmd reset* ['OPTIONS']
11
12DESCRIPTION
13-----------
14The trace-cmd(1) reset command turns off all tracing of Ftrace. This will
15bring back the performance of the system before tracing was enabled. This is
16necessary since 'trace-cmd-record(1)', 'trace-cmd-stop(1)' and
17'trace-cmd-extract(1)' do not disable the tracer, event after the data has
18been pulled from the buffers. The rational is that the user may want to
19manually enable the tracer with the Ftrace pseudo file sytem, or examine other
20parts of Ftrace to see what trace-cmd did. After the reset command happens,
21the data in the ring buffer, and the options that were used are all lost.
22
23OPTIONS
24-------
25*-b* 'buffer_size'::
26 When the kernel boots, the Ftrace ring buffer is of a miminal size (3
27 pages per CPU). The first time the tracer is used, the ring buffer size
28 expands to what it was set for (default 1.4 Megs per CPU).
29
30 If no more tracing is to be done, this option allows you to shrink the
31 ring buffer down to free up available memory.
32
33 trace-cmd reset -b 1
34
35
36SEE ALSO
37--------
38trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
39trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-split(1),
40trace-cmd-list(1), trace-cmd-listen(1)
41
42AUTHOR
43------
44Written by Steven Rostedt, <rostedt@goodmis.org>
45
46RESOURCES
47---------
48git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
49
50COPYING
51-------
52Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under
53the terms of the GNU Public License (GPL).
54
diff --git a/Documentation/trace-cmd-split.txt b/Documentation/trace-cmd-split.txt
new file mode 100644
index 0000000..43d6df3
--- /dev/null
+++ b/Documentation/trace-cmd-split.txt
@@ -0,0 +1,98 @@
1TRACE-CMD-SPLIT(1)
2==================
3
4NAME
5----
6trace-cmd-split - split a trace.dat file into smaller files
7
8SYNOPSIS
9--------
10*trace-cmd split* ['OPTIONS'] ['start-time' ['end-time']]
11
12DESCRIPTION
13-----------
14The trace-cmd(1) split is used to break up a trace.dat into small files.
15The 'start-time' specifies where the new file will start at. Using
16'trace-cmd-report(1)' and copying the time stamp given at a particular event,
17can be used as input for either 'start-time' or 'end-time'. The split will
18stop creating files when it reaches an event after 'end-time'. If only the
19end-time is needed, use 0.0 as the start-time.
20
21If start-time is left out, then the split will start at the beginning of the
22file. If end-time is left out, then split will continue to the end unless it
23meets one of the reqirements specified by the options.
24
25OPTIONS
26-------
27*-i* 'file'::
28 If this option is not specified, then the split command will look for the
29 file named 'trace.dat'. This options will allow the reading of another
30 file other than 'trace.dat'.
31
32*-o* 'file'::
33 By default, the split command will use the input file name as a basis of
34 where to write the split files. The output file will be the input file
35 with an attached \'.#\' to the end: trace.dat.1, trace.dat.2, etc.
36
37 This option will change the name of the base file used.
38
39 -o file will create file.1, file.2, etc.
40
41*-s* 'seconds'::
42 This specifies how many seconds should be recorded before the new file
43 should stop.
44
45*-m* 'milliseconds'::
46 This specifies how many milliseconds should be recorded before the new
47 file should stop.
48
49*-u* 'microseconds'::
50 This specifies how many microseconds should be recorded before the new
51 file should stop.
52
53*-e* 'events'::
54 This specifies how many events should be recorded before the new file
55 should stop.
56
57*-p* 'pages'::
58 This specifies the number of pages that should be recorded before the new
59 file should stop.
60
61 Note: only one of *-p*, *-e*, *-u*, *-m*, *-s* may be specified at a time.
62
63*-r*::
64 This option causes the break up to repeat until end-time is reached (or
65 end of the input if end-time is not specified).
66
67 trace-cmd split -r -e 10000
68
69 This will break up trace.dat into serval smaller files, each with at most
70 10,000 events in it.
71
72*-c*::
73 This option causes the above break up to be per CPU.
74
75 trace-cmd split -c -p 10
76
77 This will create a file that has 10 pages per each CPU from the input.
78
79
80SEE ALSO
81--------
82trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
83trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1),
84trace-cmd-list(1), trace-cmd-listen(1)
85
86AUTHOR
87------
88Written by Steven Rostedt, <rostedt@goodmis.org>
89
90RESOURCES
91---------
92git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
93
94COPYING
95-------
96Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under
97the terms of the GNU Public License (GPL).
98
diff --git a/Documentation/trace-cmd-start.txt b/Documentation/trace-cmd-start.txt
new file mode 100644
index 0000000..3264abf
--- /dev/null
+++ b/Documentation/trace-cmd-start.txt
@@ -0,0 +1,44 @@
1TRACE-CMD-START(1)
2===================
3
4NAME
5----
6trace-cmd-start - start the Ftrace Linux kernel tracer without recording
7
8SYNOPSIS
9--------
10*trace-cmd start* ['OPTIONS']
11
12DESCRIPTION
13-----------
14The trace-cmd(1) start enables all the Ftrace tracing the same way
15trace-cmd-record(1) does. The difference is that it does not run threads to
16create a trace.dat file. This is useful just to enable Ftrace and you are only
17interested in the trace after some event has occurred and the trace is
18stopped. Then the trace can be read straight from the Ftrace pseudo file
19system or can be extracted with trace-cmd-extract(1).
20
21OPTIONS
22-------
23The options are the same as 'trace-cmd-record(1)', except that it does not
24take options specific to recording (*-s*, *-o*, *-F*, *-N*, and *-t*).
25
26SEE ALSO
27--------
28trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-stop(1),
29trace-cmd-extract(1), trace-cmd-reset(1), trace-cmd-split(1),
30trace-cmd-list(1), trace-cmd-listen(1)
31
32AUTHOR
33------
34Written by Steven Rostedt, <rostedt@goodmis.org>
35
36RESOURCES
37---------
38git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
39
40COPYING
41-------
42Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under
43the terms of the GNU Public License (GPL).
44
diff --git a/Documentation/trace-cmd-stop.txt b/Documentation/trace-cmd-stop.txt
new file mode 100644
index 0000000..c401af1
--- /dev/null
+++ b/Documentation/trace-cmd-stop.txt
@@ -0,0 +1,46 @@
1TRACE-CMD-STOP(1)
2===================
3
4NAME
5----
6trace-cmd-stop - stop the Ftrace Linux kernel tracer from writing to the ring
7buffer.
8
9SYNOPSIS
10--------
11*trace-cmd stop*
12
13DESCRIPTION
14-----------
15The trace-cmd(1) stop is a complement to 'trace-cmd-start(1)'. This will
16disable Ftrace from writing to the ring buffer. This does not stop the
17overhead that the tracing may incur. Only the updating of the ring buffer is
18disabled, the Ftrace tracing may still be inducing overhead.
19
20After stopping the trace, the 'trace-cmd-extract(1)' may strip out the data
21from the ring buffer and create a trace.dat file. The Ftrace pseudo file
22system may also be examined.
23
24To disable the tracing completely to remove the overhead it causes, use
25'trace-cmd-reset(1)'. But after a reset is performed, the data that has been
26recorded is lost.
27
28SEE ALSO
29--------
30trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
31trace-cmd-extract(1), trace-cmd-reset(1), trace-cmd-split(1),
32trace-cmd-list(1), trace-cmd-listen(1)
33
34AUTHOR
35------
36Written by Steven Rostedt, <rostedt@goodmis.org>
37
38RESOURCES
39---------
40git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
41
42COPYING
43-------
44Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under
45the terms of the GNU Public License (GPL).
46
diff --git a/Documentation/trace-cmd.txt b/Documentation/trace-cmd.txt
new file mode 100644
index 0000000..6a02cbe
--- /dev/null
+++ b/Documentation/trace-cmd.txt
@@ -0,0 +1,73 @@
1TRACE-CMD(1)
2============
3
4NAME
5----
6trace-cmd - interacts with Ftrace Linux kernel internal tracer
7
8SYNOPSIS
9--------
10*trace-cmd* 'COMMAND' ['OPTIONS']
11
12DESCRIPTION
13-----------
14The trace-cmd(1) command interacts with the Ftrace tracer that is built inside
15the Linux kernel. It intefaces with the Ftrace specific files found in the
16debugfs file system under the tracing directory. A 'COMMAND' must be
17specified to tell trace-cmd what to do.
18
19
20COMMANDS
21--------
22
23 record - record a live trace and write a trace.dat file to the
24 local disk or to the network.
25
26 report - reads a trace.dat file and converts the binary data to a
27 ASCII text readable format.
28
29 start - start the tracing without recording to a trace.dat file.
30
31 stop - stop tracing (only disables recording, overhead of tracer
32 is still in effect)
33
34 extract - extract the data from the kernel buffer and create a trace.dat
35 file.
36
37 reset - disables all tracing and gives back the system performance.
38 (clears all data from the kernel buffers)
39
40 split - splits a trace.dat file into smaller files.
41
42 list - list the available plugins or events that can be recorded.
43
44 listen - open up a port to listen for remote tracing connections.
45
46
47OPTIONS
48-------
49
50*-h, --help::
51 Displace the help text.
52
53Other options see the man page for the corresponding command.
54
55SEE ALSO
56--------
57trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
58trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1),
59trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1)
60
61AUTHOR
62------
63Written by Steven Rostedt, <rostedt@goodmis.org>
64
65RESOURCES
66---------
67git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
68
69COPYING
70-------
71Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under
72the terms of the GNU Public License (GPL).
73