Path: blob/master/tools/perf/Documentation/perf-script.txt
10821 views
perf-script(1)1=============23NAME4----5perf-script - Read perf.data (created by perf record) and display trace output67SYNOPSIS8--------9[verse]10'perf script' [<options>]11'perf script' [<options>] record <script> [<record-options>] <command>12'perf script' [<options>] report <script> [script-args]13'perf script' [<options>] <script> <required-script-args> [<record-options>] <command>14'perf script' [<options>] <top-script> [script-args]1516DESCRIPTION17-----------18This command reads the input file and displays the trace recorded.1920There are several variants of perf script:2122'perf script' to see a detailed trace of the workload that was23recorded.2425You can also run a set of pre-canned scripts that aggregate and26summarize the raw trace data in various ways (the list of scripts is27available via 'perf script -l'). The following variants allow you to28record and run those scripts:2930'perf script record <script> <command>' to record the events required31for 'perf script report'. <script> is the name displayed in the32output of 'perf script --list' i.e. the actual script name minus any33language extension. If <command> is not specified, the events are34recorded using the -a (system-wide) 'perf record' option.3536'perf script report <script> [args]' to run and display the results37of <script>. <script> is the name displayed in the output of 'perf38trace --list' i.e. the actual script name minus any language39extension. The perf.data output from a previous run of 'perf script40record <script>' is used and should be present for this command to41succeed. [args] refers to the (mainly optional) args expected by42the script.4344'perf script <script> <required-script-args> <command>' to both45record the events required for <script> and to run the <script>46using 'live-mode' i.e. without writing anything to disk. <script>47is the name displayed in the output of 'perf script --list' i.e. the48actual script name minus any language extension. If <command> is49not specified, the events are recorded using the -a (system-wide)50'perf record' option. If <script> has any required args, they51should be specified before <command>. This mode doesn't allow for52optional script args to be specified; if optional script args are53desired, they can be specified using separate 'perf script record'54and 'perf script report' commands, with the stdout of the record step55piped to the stdin of the report script, using the '-o -' and '-i -'56options of the corresponding commands.5758'perf script <top-script>' to both record the events required for59<top-script> and to run the <top-script> using 'live-mode'60i.e. without writing anything to disk. <top-script> is the name61displayed in the output of 'perf script --list' i.e. the actual62script name minus any language extension; a <top-script> is defined63as any script name ending with the string 'top'.6465[<record-options>] can be passed to the record steps of 'perf script66record' and 'live-mode' variants; this isn't possible however for67<top-script> 'live-mode' or 'perf script report' variants.6869See the 'SEE ALSO' section for links to language-specific70information on how to write and run your own trace scripts.7172OPTIONS73-------74<command>...::75Any command you can specify in a shell.7677-D::78--dump-raw-script=::79Display verbose dump of the trace data.8081-L::82--Latency=::83Show latency attributes (irqs/preemption disabled, etc).8485-l::86--list=::87Display a list of available trace scripts.8889-s ['lang']::90--script=::91Process trace data with the given script ([lang]:script[.ext]).92If the string 'lang' is specified in place of a script name, a93list of supported languages will be displayed instead.9495-g::96--gen-script=::97Generate perf-script.[ext] starter script for given language,98using current perf.data.99100-a::101Force system-wide collection. Scripts run without a <command>102normally use -a by default, while scripts run with a <command>103normally don't - this option allows the latter to be run in104system-wide mode.105106-i::107--input=::108Input file name.109110-d::111--debug-mode::112Do various checks like samples ordering and lost events.113114-f::115--fields::116Comma separated list of fields to print. Options are:117comm, tid, pid, time, cpu, event, trace, sym. Field118list can be prepended with the type, trace, sw or hw,119to indicate to which event type the field list applies.120e.g., -f sw:comm,tid,time,sym and -f trace:time,cpu,trace121122perf script -f <fields>123124is equivalent to:125126perf script -f trace:<fields> -f sw:<fields> -f hw:<fields>127128i.e., the specified fields apply to all event types if the type string129is not given.130131The arguments are processed in the order received. A later usage can132reset a prior request. e.g.:133134-f trace: -f comm,tid,time,sym135136The first -f suppresses trace events (field list is ""), but then the137second invocation sets the fields to comm,tid,time,sym. In this case a138warning is given to the user:139140"Overriding previous field request for all events."141142Alternativey, consider the order:143144-f comm,tid,time,sym -f trace:145146The first -f sets the fields for all events and the second -f147suppresses trace events. The user is given a warning message about148the override, and the result of the above is that only S/W and H/W149events are displayed with the given fields.150151For the 'wildcard' option if a user selected field is invalid for an152event type, a message is displayed to the user that the option is153ignored for that type. For example:154155$ perf script -f comm,tid,trace156'trace' not valid for hardware events. Ignoring.157'trace' not valid for software events. Ignoring.158159Alternatively, if the type is given an invalid field is specified it160is an error. For example:161162perf script -v -f sw:comm,tid,trace163'trace' not valid for software events.164165At this point usage is displayed, and perf-script exits.166167Finally, a user may not set fields to none for all event types.168i.e., -f "" is not allowed.169170-k::171--vmlinux=<file>::172vmlinux pathname173174--kallsyms=<file>::175kallsyms pathname176177--symfs=<directory>::178Look for files with symbols relative to this directory.179180-G::181--hide-call-graph::182When printing symbols do not display call chain.183184SEE ALSO185--------186linkperf:perf-record[1], linkperf:perf-script-perl[1],187linkperf:perf-script-python[1]188189190