1PERF-SCRIPT(1) perf Manual PERF-SCRIPT(1)
2
3
4
6 perf-script - Read perf.data (created by perf record) and display trace
7 output
8
10 perf script [<options>]
11 perf script [<options>] record <script> [<record-options>] <command>
12 perf script [<options>] report <script> [script-args]
13 perf script [<options>] <script> <required-script-args> [<record-options>] <command>
14 perf script [<options>] <top-script> [script-args]
15
17 This command reads the input file and displays the trace recorded.
18
19 There are several variants of perf script:
20
21 ´perf script´ to see a detailed trace of the workload that was
22 recorded.
23
24 You can also run a set of pre-canned scripts that aggregate and
25 summarize the raw trace data in various ways (the list of scripts is
26 available via ´perf script -l´). The following variants allow you to
27 record and run those scripts:
28
29 ´perf script record <script> <command>´ to record the events required
30 for ´perf script report´. <script> is the name displayed in the
31 output of ´perf script --list´ i.e. the actual script name minus any
32 language extension. If <command> is not specified, the events are
33 recorded using the -a (system-wide) ´perf record´ option.
34
35 ´perf script report <script> [args]´ to run and display the results
36 of <script>. <script> is the name displayed in the output of ´perf
37 trace --list´ i.e. the actual script name minus any language
38 extension. The perf.data output from a previous run of ´perf script
39 record <script>´ is used and should be present for this command to
40 succeed. [args] refers to the (mainly optional) args expected by
41 the script.
42
43 ´perf script <script> <required-script-args> <command>´ to both
44 record the events required for <script> and to run the <script>
45 using ´live-mode´ i.e. without writing anything to disk. <script>
46 is the name displayed in the output of ´perf script --list´ i.e. the
47 actual script name minus any language extension. If <command> is
48 not specified, the events are recorded using the -a (system-wide)
49 ´perf record´ option. If <script> has any required args, they
50 should be specified before <command>. This mode doesn´t allow for
51 optional script args to be specified; if optional script args are
52 desired, they can be specified using separate ´perf script record´
53 and ´perf script report´ commands, with the stdout of the record step
54 piped to the stdin of the report script, using the ´-o -´ and ´-i -´
55 options of the corresponding commands.
56
57 ´perf script <top-script>´ to both record the events required for
58 <top-script> and to run the <top-script> using ´live-mode´
59 i.e. without writing anything to disk. <top-script> is the name
60 displayed in the output of ´perf script --list´ i.e. the actual
61 script name minus any language extension; a <top-script> is defined
62 as any script name ending with the string ´top´.
63
64 [<record-options>] can be passed to the record steps of ´perf script
65 record´ and ´live-mode´ variants; this isn´t possible however for
66 <top-script> ´live-mode´ or ´perf script report´ variants.
67
68 See the ´SEE ALSO´ section for links to language-specific
69 information on how to write and run your own trace scripts.
70
72 <command>...
73 Any command you can specify in a shell.
74
75 -D, --dump-raw-script=
76 Display verbose dump of the trace data.
77
78 -L, --Latency=
79 Show latency attributes (irqs/preemption disabled, etc).
80
81 -l, --list=
82 Display a list of available trace scripts.
83
84 -s [lang], --script=
85 Process trace data with the given script ([lang]:script[.ext]). If
86 the string lang is specified in place of a script name, a list of
87 supported languages will be displayed instead.
88
89 -g, --gen-script=
90 Generate perf-script.[ext] starter script for given language, using
91 current perf.data.
92
93 -a
94 Force system-wide collection. Scripts run without a <command>
95 normally use -a by default, while scripts run with a <command>
96 normally don’t - this option allows the latter to be run in
97 system-wide mode.
98
99 -i, --input=
100 Input file name. (default: perf.data unless stdin is a fifo)
101
102 -d, --debug-mode
103 Do various checks like samples ordering and lost events.
104
105 -f, --fields
106 Comma separated list of fields to print. Options are: comm, tid,
107 pid, time, cpu, event, trace, ip, sym, dso, addr, symoff, srcline,
108 period. Field list can be prepended with the type, trace, sw or hw,
109 to indicate to which event type the field list applies. e.g., -f
110 sw:comm,tid,time,ip,sym and -f trace:time,cpu,trace
111
112 perf script -f <fields>
113
114 is equivalent to:
115
116 perf script -f trace:<fields> -f sw:<fields> -f hw:<fields>
117
118 i.e., the specified fields apply to all event types if the type string
119 is not given.
120
121 The arguments are processed in the order received. A later usage can
122 reset a prior request. e.g.:
123
124 -f trace: -f comm,tid,time,ip,sym
125
126 The first -f suppresses trace events (field list is ""), but then the
127 second invocation sets the fields to comm,tid,time,ip,sym. In this case a
128 warning is given to the user:
129
130 "Overriding previous field request for all events."
131
132 Alternatively, consider the order:
133
134 -f comm,tid,time,ip,sym -f trace:
135
136 The first -f sets the fields for all events and the second -f
137 suppresses trace events. The user is given a warning message about
138 the override, and the result of the above is that only S/W and H/W
139 events are displayed with the given fields.
140
141 For the ´wildcard´ option if a user selected field is invalid for an
142 event type, a message is displayed to the user that the option is
143 ignored for that type. For example:
144
145 $ perf script -f comm,tid,trace
146 ´trace´ not valid for hardware events. Ignoring.
147 ´trace´ not valid for software events. Ignoring.
148
149 Alternatively, if the type is given an invalid field is specified it
150 is an error. For example:
151
152 perf script -v -f sw:comm,tid,trace
153 ´trace´ not valid for software events.
154
155 At this point usage is displayed, and perf-script exits.
156
157 Finally, a user may not set fields to none for all event types.
158 i.e., -f "" is not allowed.
159
160 -k, --vmlinux=<file>
161 vmlinux pathname
162
163 --kallsyms=<file>
164 kallsyms pathname
165
166 --symfs=<directory>
167 Look for files with symbols relative to this directory.
168
169 -G, --hide-call-graph
170 When printing symbols do not display call chain.
171
172 -C, --cpu
173 Only report samples for the list of CPUs provided. Multiple CPUs
174 can be provided as a comma-separated list with no space: 0,1.
175 Ranges of CPUs are specified with -: 0-2. Default is to report
176 samples on all CPUs.
177
178 -c, --comms=
179 Only display events for these comms. CSV that understands
180 file://filename entries.
181
182 --pid=
183 Only show events for given process ID (comma separated list).
184
185 --tid=
186 Only show events for given thread ID (comma separated list).
187
188 -I, --show-info
189 Display extended information about the perf.data file. This adds
190 information which may be very large and thus may clutter the
191 display. It currently includes: cpu and numa topology of the host
192 system. It can only be used with the perf script report mode.
193
194 --show-kernel-path
195 Try to resolve the path of [kernel.kallsyms]
196
197 --show-task-events Display task related events (e.g. FORK, COMM, EXIT).
198
199 --show-mmap-events Display mmap related events (e.g. MMAP, MMAP2).
200
201 --header Show perf.data header.
202
203 --header-only Show only perf.data header.
204
205 --full-source-path
206 Show the full path for source files for srcline output.
207
209 perf-record(1), perf-script-perl(1), perf-script-python(1)
210
211
212
213perf 06/18/2019 PERF-SCRIPT(1)