Off-CPU flame graphs with perf: what should the types of the output fields be?

727 Views Asked by At

I've been following these instructions for generating an off-CPU flame graph for my code. However, when I get to this step:

perf script -f comm,pid,tid,cpu,time,period,event,ip,sym,dso,trace

I get the following error:

Invalid field requested.

 Usage: perf script [<options>]
    or: perf script [<options>] record <script> [<record-options>] <command>
    or: perf script [<options>] report <script> [script-args]
    or: perf script [<options>] <script> [<record-options>] <command>
    or: perf script [<options>] <top-script> [script-args]

    -F, --fields <str>    comma separated output fields prepend with 'type:'. Valid types: hw,sw,trace,raw. Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso,addr,symoff,period,iregs,brstack,brstacksym,flags,bpf-output,callindent,insn,insnlen

I understand that each of the output fields needs to have a type, but I am unsure which type(s) I should be providing. Could someone point me in the right direction?

1

There are 1 best solutions below

0
On

Update: on more recent kernels, use "perf script -F ..." instead of "perf script -f ...". Your kernel will also need CONFIG_SCHEDSTATS for the tracepoints to all be present, which may be missing (eg, RHEL7).

Note, please set the /proc/sys/kernel/sched_schedstats to 1 before you draw the off-cpu flamegraph.