xref: /aosp_15_r20/external/bpftool/docs/bpftool-perf.rst (revision 858ea5e570667251cdc31d3fe7b846b591105938)
1*858ea5e5SAndroid Build Coastguard Worker.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*858ea5e5SAndroid Build Coastguard Worker
3*858ea5e5SAndroid Build Coastguard Worker================
4*858ea5e5SAndroid Build Coastguard Workerbpftool-perf
5*858ea5e5SAndroid Build Coastguard Worker================
6*858ea5e5SAndroid Build Coastguard Worker-------------------------------------------------------------------------------
7*858ea5e5SAndroid Build Coastguard Workertool for inspection of perf related bpf prog attachments
8*858ea5e5SAndroid Build Coastguard Worker-------------------------------------------------------------------------------
9*858ea5e5SAndroid Build Coastguard Worker
10*858ea5e5SAndroid Build Coastguard Worker:Manual section: 8
11*858ea5e5SAndroid Build Coastguard Worker
12*858ea5e5SAndroid Build Coastguard Worker.. include:: substitutions.rst
13*858ea5e5SAndroid Build Coastguard Worker
14*858ea5e5SAndroid Build Coastguard WorkerSYNOPSIS
15*858ea5e5SAndroid Build Coastguard Worker========
16*858ea5e5SAndroid Build Coastguard Worker
17*858ea5e5SAndroid Build Coastguard Worker	**bpftool** [*OPTIONS*] **perf** *COMMAND*
18*858ea5e5SAndroid Build Coastguard Worker
19*858ea5e5SAndroid Build Coastguard Worker	*OPTIONS* := { |COMMON_OPTIONS| }
20*858ea5e5SAndroid Build Coastguard Worker
21*858ea5e5SAndroid Build Coastguard Worker	*COMMANDS* :=
22*858ea5e5SAndroid Build Coastguard Worker	{ **show** | **list** | **help** }
23*858ea5e5SAndroid Build Coastguard Worker
24*858ea5e5SAndroid Build Coastguard WorkerPERF COMMANDS
25*858ea5e5SAndroid Build Coastguard Worker=============
26*858ea5e5SAndroid Build Coastguard Worker
27*858ea5e5SAndroid Build Coastguard Worker|	**bpftool** **perf** { **show** | **list** }
28*858ea5e5SAndroid Build Coastguard Worker|	**bpftool** **perf help**
29*858ea5e5SAndroid Build Coastguard Worker
30*858ea5e5SAndroid Build Coastguard WorkerDESCRIPTION
31*858ea5e5SAndroid Build Coastguard Worker===========
32*858ea5e5SAndroid Build Coastguard Worker	**bpftool perf { show | list }**
33*858ea5e5SAndroid Build Coastguard Worker		  List all raw_tracepoint, tracepoint, kprobe attachment in the system.
34*858ea5e5SAndroid Build Coastguard Worker
35*858ea5e5SAndroid Build Coastguard Worker		  Output will start with process id and file descriptor in that process,
36*858ea5e5SAndroid Build Coastguard Worker		  followed by bpf program id, attachment information, and attachment point.
37*858ea5e5SAndroid Build Coastguard Worker		  The attachment point for raw_tracepoint/tracepoint is the trace probe name.
38*858ea5e5SAndroid Build Coastguard Worker		  The attachment point for k[ret]probe is either symbol name and offset,
39*858ea5e5SAndroid Build Coastguard Worker		  or a kernel virtual address.
40*858ea5e5SAndroid Build Coastguard Worker		  The attachment point for u[ret]probe is the file name and the file offset.
41*858ea5e5SAndroid Build Coastguard Worker
42*858ea5e5SAndroid Build Coastguard Worker	**bpftool perf help**
43*858ea5e5SAndroid Build Coastguard Worker		  Print short help message.
44*858ea5e5SAndroid Build Coastguard Worker
45*858ea5e5SAndroid Build Coastguard WorkerOPTIONS
46*858ea5e5SAndroid Build Coastguard Worker=======
47*858ea5e5SAndroid Build Coastguard Worker	.. include:: common_options.rst
48*858ea5e5SAndroid Build Coastguard Worker
49*858ea5e5SAndroid Build Coastguard WorkerEXAMPLES
50*858ea5e5SAndroid Build Coastguard Worker========
51*858ea5e5SAndroid Build Coastguard Worker
52*858ea5e5SAndroid Build Coastguard Worker| **# bpftool perf**
53*858ea5e5SAndroid Build Coastguard Worker
54*858ea5e5SAndroid Build Coastguard Worker::
55*858ea5e5SAndroid Build Coastguard Worker
56*858ea5e5SAndroid Build Coastguard Worker      pid 21711  fd 5: prog_id 5  kprobe  func __x64_sys_write  offset 0
57*858ea5e5SAndroid Build Coastguard Worker      pid 21765  fd 5: prog_id 7  kretprobe  func __x64_sys_nanosleep  offset 0
58*858ea5e5SAndroid Build Coastguard Worker      pid 21767  fd 5: prog_id 8  tracepoint  sys_enter_nanosleep
59*858ea5e5SAndroid Build Coastguard Worker      pid 21800  fd 5: prog_id 9  uprobe  filename /home/yhs/a.out  offset 1159
60*858ea5e5SAndroid Build Coastguard Worker
61*858ea5e5SAndroid Build Coastguard Worker|
62*858ea5e5SAndroid Build Coastguard Worker| **# bpftool -j perf**
63*858ea5e5SAndroid Build Coastguard Worker
64*858ea5e5SAndroid Build Coastguard Worker::
65*858ea5e5SAndroid Build Coastguard Worker
66*858ea5e5SAndroid Build Coastguard Worker    [{"pid":21711,"fd":5,"prog_id":5,"fd_type":"kprobe","func":"__x64_sys_write","offset":0}, \
67*858ea5e5SAndroid Build Coastguard Worker     {"pid":21765,"fd":5,"prog_id":7,"fd_type":"kretprobe","func":"__x64_sys_nanosleep","offset":0}, \
68*858ea5e5SAndroid Build Coastguard Worker     {"pid":21767,"fd":5,"prog_id":8,"fd_type":"tracepoint","tracepoint":"sys_enter_nanosleep"}, \
69*858ea5e5SAndroid Build Coastguard Worker     {"pid":21800,"fd":5,"prog_id":9,"fd_type":"uprobe","filename":"/home/yhs/a.out","offset":1159}]
70