• Home
  • Raw
  • Download

Lines Matching refs:perf

1 perf-script-python(1)
6 perf-script-python - Process trace data with a Python script
11 'perf script' [-s [Python]:script[.py] ]
16 This perf script option is used to process perf script data using perf's
26 raw perf script stream. You can avoid reading the rest of this
32 'syscall-counts' script you see when you list the available perf script
33 scripts via 'perf script -l'. As such, this script also shows how to
34 integrate your script into the list of general-purpose 'perf script'
81 allowable by perf. These individual syscall events will however be
92 don't care how it exited, so we'll use 'perf record' to record only
96 # perf record -a -e raw_syscalls:sys_enter
98 ^C[ perf record: Woken up 1 times to write data ]
99 [ perf record: Captured and wrote 56.545 MB perf.data (~2470503 samples) ]
105 called perf.data.
107 Once we have a perf.data file containing our data, we can use the -g
108 'perf script' option to generate a Python script that will contain a
109 callback handler for each event type found in the perf.data trace
113 # perf script -g python
114 generated Python script: perf-script.py
117 perf-script.py. Here's the file in its entirety:
119 # perf script event handlers, generated by perf script -g python
126 # See the perf-script-python Documentation for the list of available functions.
132 '/scripts/python/perf-script-Util/lib/Perf/Trace')
163 path append which every perf script script should include.
171 every event in the 'perf record' output. The handler functions take
179 every time the script finds an event in the perf.data file that
192 # mv perf-script.py syscall-counts.py
193 # perf script -s syscall-counts.py
195 raw_syscalls__sys_enter 1 00840.847582083 7506 perf id=1, args=
196 raw_syscalls__sys_enter 1 00840.847595764 7506 perf id=1, args=
197 raw_syscalls__sys_enter 1 00840.847620860 7506 perf id=1, args=
219 '/scripts/python/perf-script-Util/lib/Perf/Trace')
282 '/scripts/python/perf-script-Util/lib/Perf/Trace')
318 # perf script -s syscall-counts.py
324 'perf list' and/or look in /sys/kernel/debug/tracing events for
326 using 'perf record', passing it the list of interesting events,
327 generate a skeleton script using 'perf script -g python' and modify the
334 scripts listed by the 'perf script -l' command e.g.:
337 root@tropicana:~# perf script -l
346 probably lengthy 'perf record' command needed to record the events for
354 into the perf/scripts/python/bin directory in the kernel source tree.
355 In that script, you write the 'perf record' command-line needed for
359 # cat kernel-source/tools/perf/scripts/python/bin/syscall-counts-record
362 perf record -a -e raw_syscalls:sys_enter
367 the perf/scripts/python/bin directory. In that script, you write the
368 'perf script -s' command-line needed for running your script:
371 # cat kernel-source/tools/perf/scripts/python/bin/syscall-counts-report
375 perf script -s ~/libexec/perf-core/scripts/python/syscall-counts.py
379 is in the libexec/perf-core/scripts/python directory - this is where
380 the script will be copied by 'make install' when you install perf.
382 to be located in the perf/scripts/python directory in the kernel
386 # ls -al kernel-source/tools/perf/scripts/python
388 root@tropicana:/home/trz/src/tip# ls -al tools/perf/scripts/python
393 -rw-r--r-- 1 trz trz 2548 2010-01-26 22:29 check-perf-script.py
394 drwxr-xr-x 3 trz trz 4096 2010-01-26 22:49 perf-script-Util
399 otherwise your script won't show up at run-time), 'perf script -l'
403 root@tropicana:~# perf script -l
412 You can now perform the record step via 'perf script record':
414 # perf script record syscall-counts
416 and display the output using 'perf script report':
418 # perf script report syscall-counts
424 trace data by generating a skeleton script using 'perf script -g
425 python' in the same directory as an existing perf.data trace file.
431 ~/libexec/perf-core/scripts/python for typical examples showing how to
433 the check-perf-script.py script, while not interesting for its results,
439 When perf script is invoked using a trace script, a user-defined
447 available as calls back into the perf executable (see below).
449 As an example, the following perf record command can be used to record
452 # perf record -a -e sched:sched_wakeup
494 context an opaque 'cookie' used in calls back into perf
512 Every perf script Python script should start by setting up a Python
521 '/scripts/python/perf-script-Util/lib/Perf/Trace')
561 built-in perf script Python modules and their associated functions.
567 via the various perf script Python modules. To use the functions and
569 import' line to your perf script script.
612 Various utility functions for use with perf script:
622 linkperf:perf-script[1]