1PERF-TRACE(1) perf Manual PERF-TRACE(1)
2
3
4
6 perf-trace - strace inspired tool
7
9 perf trace
10 perf trace record
11
13 This command will show the events associated with the target, initially
14 syscalls, but other system events like pagefaults, task lifetime
15 events, scheduling events, etc.
16
17 This is a live mode tool in addition to working with perf.data files
18 like the other perf tools. Files can be generated using the perf record
19 command but the session needs to include the raw_syscalls events (-e
20 raw_syscalls:*). Alternatively, perf trace record can be used as a
21 shortcut to automatically include the raw_syscalls events when writing
22 events to a file.
23
24 The following options apply to perf trace; options to perf trace record
25 are found in the perf record man page.
26
28 -a, --all-cpus
29 System-wide collection from all CPUs.
30
31 -e, --expr, --event
32 List of syscalls and other perf events (tracepoints, HW cache
33 events, etc) to show. Globbing is supported, e.g.: "epoll_*",
34 "msg", etc. See perf list for a complete list of events. Prefixing
35 with ! shows all syscalls but the ones specified. You may need to
36 escape it.
37
38 -D msecs, --delay msecs
39 After starting the program, wait msecs before measuring. This is
40 useful to filter out the startup phase of the program, which is
41 often very different.
42
43 -o, --output=
44 Output file name.
45
46 -p, --pid=
47 Record events on existing process ID (comma separated list).
48
49 -t, --tid=
50 Record events on existing thread ID (comma separated list).
51
52 -u, --uid=
53 Record events in threads owned by uid. Name or number.
54
55 --filter-pids=
56 Filter out events for these pids and for trace itself (comma
57 separated list).
58
59 -v, --verbose=
60 Verbosity level.
61
62 --no-inherit
63 Child tasks do not inherit counters.
64
65 -m, --mmap-pages=
66 Number of mmap data pages (must be a power of two) or size
67 specification with appended unit character - B/K/M/G. The size is
68 rounded up to have nearest pages power of two value.
69
70 -C, --cpu
71 Collect samples only on the list of CPUs provided. Multiple CPUs
72 can be provided as a comma-separated list with no space: 0,1.
73 Ranges of CPUs are specified with -: 0-2. In per-thread mode with
74 inheritance mode on (default), Events are captured only when the
75 thread executes on the designated CPUs. Default is to monitor all
76 CPUs.
77
78 --duration: Show only events that had a duration greater than N.M ms.
79
80 --sched: Accrue thread runtime and provide a summary at the end of the
81 session.
82
83 -i --input Process events from a given perf data file.
84
85 -T --time Print full timestamp rather time relative to first sample.
86
87 --comm
88 Show process COMM right beside its ID, on by default, disable with
89 --no-comm.
90
91 -s, --summary
92 Show only a summary of syscalls by thread with min, max, and
93 average times (in msec) and relative stddev.
94
95 -S, --with-summary
96 Show all syscalls followed by a summary by thread with min, max,
97 and average times (in msec) and relative stddev.
98
99 --tool_stats
100 Show tool stats such as number of times fd→pathname was discovered
101 thru hooking the open syscall return + vfs_getname or via reading
102 /proc/pid/fd, etc.
103
104 -F=[all|min|maj], --pf=[all|min|maj]
105 Trace pagefaults. Optionally, you can specify whether you want
106 minor, major or all pagefaults. Default value is maj.
107
108 --syscalls
109 Trace system calls. This options is enabled by default, disable
110 with --no-syscalls.
111
112 --call-graph [mode,type,min[,limit],order[,key][,branch]]
113 Setup and enable call-graph (stack chain/backtrace) recording. See
114 --call-graph section in perf-record and perf-report man pages for
115 details. The ones that are most useful in perf trace are dwarf and
116 lbr, where available, try: perf trace --call-graph dwarf.
117
118 Using this will, for the root user, bump the value of --mmap-pages to 4
119 times the maximum for non-root users, based on the kernel.perf_event_mlock_kb
120 sysctl. This is done only if the user doesn't specify a --mmap-pages value.
121
122 --kernel-syscall-graph
123 Show the kernel callchains on the syscall exit path.
124
125 --max-stack
126 Set the stack depth limit when parsing the callchain, anything
127 beyond the specified depth will be ignored. Note that at this point
128 this is just about the presentation part, i.e. the kernel is still
129 not limiting, the overhead of callchains needs to be set via the
130 knobs in --call-graph dwarf.
131
132 Implies '--call-graph dwarf' when --call-graph not present on the
133 command line, on systems where DWARF unwinding was built in.
134
135 Default: /proc/sys/kernel/perf_event_max_stack when present, 127 otherwise.
136
137 --min-stack
138 Set the stack depth limit when parsing the callchain, anything
139 below the specified depth will be ignored. Disabled by default.
140
141 Implies '--call-graph dwarf' when --call-graph not present on the
142 command line, on systems where DWARF unwinding was built in.
143
144 --proc-map-timeout
145 When processing pre-existing threads /proc/XXX/mmap, it may take a
146 long time, because the file may be huge. A time out is needed in
147 such cases. This option sets the time out limit. The default value
148 is 500 ms.
149
151 When tracing pagefaults, the format of the trace is as follows:
152
153 <min|maj>fault [<ip.symbol>+<ip.offset>] ⇒ <addr.dso@addr.offset[1]>
154 (<map type><addr level>).
155
156 · min/maj indicates whether fault event is minor or major;
157
158 · ip.symbol shows symbol for instruction pointer (the code that
159 generated the fault); if no debug symbols available, perf trace
160 will print raw IP;
161
162 · addr.dso shows DSO for the faulted address;
163
164 · map type is either d for non-executable maps or x for executable
165 maps;
166
167 · addr level is either k for kernel dso or . for user dso.
168
169 For symbols resolution you may need to install debugging symbols.
170
171 Please be aware that duration is currently always 0 and doesn’t reflect
172 actual time it took for fault to be handled!
173
174 When --verbose specified, perf trace tries to print all available
175 information for both IP and fault address in the form of
176 dso@symbol[2]+offset.
177
179 Trace only major pagefaults:
180
181 $ perf trace --no-syscalls -F
182
183 Trace syscalls, major and minor pagefaults:
184
185 $ perf trace -F all
186
187 1416.547 ( 0.000 ms): python/20235 majfault [CRYPTO_push_info_+0x0] => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0@0x61be0 (x.)
188
189 As you can see, there was major pagefault in python process, from
190 CRYPTO_push_info_ routine which faulted somewhere in libcrypto.so.
191
193 perf-record(1), perf-script(1)
194
196 1. addr.dso@addr.offset
197 mailto:addr.dso@addr.offset
198
199 2. dso@symbol
200 mailto:dso@symbol
201
202
203
204perf 06/18/2019 PERF-TRACE(1)