1PERF-LOCK(1)                      perf Manual                     PERF-LOCK(1)
2
3
4

NAME

6       perf-lock - Analyze lock events
7

SYNOPSIS

9       perf lock {record|report|script|info|contention}
10

DESCRIPTION

12       You can analyze various lock behaviours and statistics with this perf
13       lock command.
14
15           'perf lock record <command>' records lock events
16           between start and end <command>. And this command
17           produces the file "perf.data" which contains tracing
18           results of lock events.
19
20           'perf lock report' reports statistical data.
21
22           'perf lock script' shows raw lock events.
23
24           'perf lock info' shows metadata like threads or addresses
25           of lock instances.
26
27           'perf lock contention' shows contention statistics.
28

COMMON OPTIONS

30       -i, --input=<file>
31           Input file name. (default: perf.data unless stdin is a fifo)
32
33       --output=<file>
34           Output file name for perf lock contention and report.
35
36       -v, --verbose
37           Be more verbose (show symbol address, etc).
38
39       -q, --quiet
40           Do not show any warnings or messages. (Suppress -v)
41
42       -D, --dump-raw-trace
43           Dump raw trace in ASCII.
44
45       -f, --force
46           Don’t complain, do it.
47
48       --vmlinux=<file>
49           vmlinux pathname
50
51       --kallsyms=<file>
52           kallsyms pathname
53

REPORT OPTIONS

55       -k, --key=<value>
56           Sorting key. Possible values: acquired (default), contended,
57           avg_wait, wait_total, wait_max, wait_min.
58
59       -F, --field=<value>
60           Output fields. By default it shows all the fields but users can
61           customize that using this. Possible values: acquired, contended,
62           avg_wait, wait_total, wait_max, wait_min.
63
64       -c, --combine-locks
65           Merge lock instances in the same class (based on name).
66
67       -t, --threads
68           The -t option is to show per-thread lock stat like below:
69
70               $ perf lock report -t -F acquired,contended,avg_wait
71
72               Name   acquired  contended   avg wait (ns)
73
74                          perf     240569          9            5784
75                       swapper     106610         19             543
76                        :15789      17370          2           14538
77                  ContainerMgr       8981          6             874
78                         sleep       5275          1           11281
79               ContainerThread       4416          4             944
80               RootPressureThr       3215          5            1215
81                   rcu_preempt       2954          0               0
82                  ContainerMgr       2560          0               0
83                       unnamed       1873          0               0
84               EventManager_De       1845          1             636
85               futex-default-S       1609          0               0
86
87       -E, --entries=<value>
88           Display this many entries.
89

INFO OPTIONS

91       -t, --threads
92           dump thread list in perf.data
93
94       -m, --map
95           dump map of lock instances (address:name table)
96
97       CONTENTION OPTIONS
98
99
100           .ft C
101           -k::
102           --key=<value>::
103                   Sorting key. Possible values: contended, wait_total (default),
104                   wait_max, wait_min, avg_wait.
105
106           -F::
107           --field=<value>::
108                   Output fields. By default it shows all but the wait_min fields
109                   and users can customize that using this.  Possible values:
110                   contended, wait_total, wait_max, wait_min, avg_wait.
111
112           -t::
113           --threads::
114                   Show per-thread lock contention stat
115
116           -b::
117           --use-bpf::
118                   Use BPF program to collect lock contention stats instead of
119                   using the input data.
120
121           -a::
122           --all-cpus::
123                   System-wide collection from all CPUs.
124
125           -C::
126           --cpu=<value>::
127                   Collect samples only on the list of CPUs provided. Multiple CPUs can be
128                   provided as a comma-separated list with no space: 0,1. Ranges of CPUs
129                   are specified with -: 0-2.  Default is to monitor all CPUs.
130
131           -p::
132           --pid=<value>::
133                   Record events on existing process ID (comma separated list).
134
135           --tid=<value>::
136                   Record events on existing thread ID (comma separated list).
137
138           -M::
139           --map-nr-entries=<value>::
140                   Maximum number of BPF map entries (default: 16384).
141                   This will be aligned to a power of 2.
142
143           --max-stack=<value>::
144                   Maximum stack depth when collecting lock contention (default: 8).
145
146           --stack-skip=<value>::
147                   Number of stack depth to skip when finding a lock caller (default: 3).
148
149           -E::
150           --entries=<value>::
151                   Display this many entries.
152
153           -l::
154           --lock-addr::
155                   Show lock contention stat by address
156
157           -o::
158           --lock-owner::
159                   Show lock contention stat by owners.  Implies --threads and
160                   requires --use-bpf.
161
162           -Y::
163           --type-filter=<value>::
164                   Show lock contention only for given lock types (comma separated list).
165                   Available values are:
166                     semaphore, spinlock, rwlock, rwlock:R, rwlock:W, rwsem, rwsem:R, rwsem:W,
167                     rtmutex, rwlock-rt, rwlock-rt:R, rwlock-rt:W, pcpu-sem, pcpu-sem:R, pcpu-sem:W,
168                     mutex
169
170                   Note that RW-variant of locks have :R and :W suffix.  Names without the
171                   suffix are shortcuts for the both variants.  Ex) rwsem = rwsem:R + rwsem:W.
172
173           -L::
174           --lock-filter=<value>::
175                   Show lock contention only for given lock addresses or names (comma separated list).
176
177           -S::
178           --callstack-filter=<value>::
179                   Show lock contention only if the callstack contains the given string.
180                   Note that it matches the substring so 'rq' would match both 'raw_spin_rq_lock'
181                   and 'irq_enter_rcu'.
182
183           -x::
184           --field-separator=<SEP>::
185                   Show results using a CSV-style output to make it easy to import directly
186                   into spreadsheets. Columns are separated by the string specified in SEP.
187
188
189           SEE ALSO
190           .ft
191
192
193       perf(1)
194
195
196
197perf                              11/28/2023                      PERF-LOCK(1)
Impressum