xref: /OK3568_Linux_fs/kernel/tools/perf/Documentation/tips.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunFor a higher level overview, try: perf report --sort comm,dso
2*4882a593SmuzhiyunSample related events with: perf record -e '{cycles,instructions}:S'
3*4882a593SmuzhiyunCompare performance results with: perf diff [<old file> <new file>]
4*4882a593SmuzhiyunBoolean options have negative forms, e.g.: perf report --no-children
5*4882a593SmuzhiyunCustomize output of perf script with: perf script -F event,ip,sym
6*4882a593SmuzhiyunGenerate a script for your data: perf script -g <lang>
7*4882a593SmuzhiyunSave output of perf stat using: perf stat record <target workload>
8*4882a593SmuzhiyunCreate an archive with symtabs to analyse on other machine: perf archive
9*4882a593SmuzhiyunSearch options using a keyword: perf report -h <keyword>
10*4882a593SmuzhiyunUse parent filter to see specific call path: perf report -p <regex>
11*4882a593SmuzhiyunList events using substring match: perf list <keyword>
12*4882a593SmuzhiyunTo see list of saved events and attributes: perf evlist -v
13*4882a593SmuzhiyunUse --symfs <dir> if your symbol files are in non-standard locations
14*4882a593SmuzhiyunTo see callchains in a more compact form: perf report -g folded
15*4882a593SmuzhiyunShow individual samples with: perf script
16*4882a593SmuzhiyunLimit to show entries above 5% only: perf report --percent-limit 5
17*4882a593SmuzhiyunProfiling branch (mis)predictions with: perf record -b / perf report
18*4882a593SmuzhiyunTo show assembler sample contexts use perf record -b / perf script -F +brstackinsn --xed
19*4882a593SmuzhiyunTreat branches as callchains: perf report --branch-history
20*4882a593SmuzhiyunTo count events in every 1000 msec: perf stat -I 1000
21*4882a593SmuzhiyunPrint event counts in CSV format with: perf stat -x,
22*4882a593SmuzhiyunIf you have debuginfo enabled, try: perf report -s sym,srcline
23*4882a593SmuzhiyunFor memory address profiling, try: perf mem record / perf mem report
24*4882a593SmuzhiyunFor tracepoint events, try: perf report -s trace_fields
25*4882a593SmuzhiyunTo record callchains for each sample: perf record -g
26*4882a593SmuzhiyunTo record every process run by a user: perf record -u <user>
27*4882a593SmuzhiyunSkip collecting build-id when recording: perf record -B
28*4882a593SmuzhiyunTo change sampling frequency to 100 Hz: perf record -F 100
29*4882a593SmuzhiyunSee assembly instructions with percentage: perf annotate <symbol>
30*4882a593SmuzhiyunIf you prefer Intel style assembly, try: perf annotate -M intel
31*4882a593SmuzhiyunFor hierarchical output, try: perf report --hierarchy
32*4882a593SmuzhiyunOrder by the overhead of source file name and line number: perf report -s srcline
33*4882a593SmuzhiyunSystem-wide collection from all CPUs: perf record -a
34*4882a593SmuzhiyunShow current config key-value pairs: perf config --list
35*4882a593SmuzhiyunShow user configuration overrides: perf config --user --list
36*4882a593SmuzhiyunTo add Node.js USDT(User-Level Statically Defined Tracing): perf buildid-cache --add `which node`
37*4882a593SmuzhiyunTo report cacheline events from previous recording: perf c2c report
38*4882a593SmuzhiyunTo browse sample contexts use perf report --sample 10 and select in context menu
39*4882a593SmuzhiyunTo separate samples by time use perf report --sort time,overhead,sym
40*4882a593SmuzhiyunTo set sample time separation other than 100ms with --sort time use --time-quantum
41*4882a593SmuzhiyunAdd -I to perf record to sample register values, which will be visible in perf report sample context.
42*4882a593SmuzhiyunTo show IPC for sampling periods use perf record -e '{cycles,instructions}:S' and then browse context
43*4882a593SmuzhiyunTo show context switches in perf report sample context add --switch-events to perf record.
44