Lines Matching refs:script

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
19 Python script, if any.
25 Python script that aggregates and extracts useful information from a
26 raw perf script stream. You can avoid reading the rest of this
29 available to script writers.
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'
37 The syscall-counts script is a simple script, but demonstrates all the
38 basic ideas necessary to create a useful script. Here's an example
74 every time a system call occurs in the system. Our script will do
76 that script. Theoretically, there are a couple of ways we could do
91 For this script, we only need to know that a syscall was entered; we
108 'perf script' option to generate a Python script that will contain a
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.
167 script respectively (for more details, see the SCRIPT_LAYOUT section
178 generated for every script. The first, trace_unhandled(), is called
179 every time the script finds an event in the perf.data file that
180 doesn't correspond to any event handler in the script. This could
182 really interested in, or the script was run against a trace file that
183 doesn't correspond to the script.
185 The script generated by -g option simply prints a line for each
189 script and run it to see the default output:
192 # mv perf-script.py syscall-counts.py
193 # perf script -s syscall-counts.py
208 Of course, for this script, we're not interested in printing every
219 '/scripts/python/perf-script-Util/lib/Perf/Trace')
271 handler called at the end of script processing.
273 The final script producing the output shown above is shown in its
282 '/scripts/python/perf-script-Util/lib/Perf/Trace')
316 The script can be run just as before:
318 # perf script -s syscall-counts.py
320 So those are the essential steps in writing and running a script. The
327 generate a skeleton script using 'perf script -g python' and modify the
330 After you've done that you may end up with a general-purpose script
333 right place, you can have your script listed alongside the other
334 scripts listed by the 'perf script -l' command e.g.:
337 root@tropicana:~# perf script -l
347 the script.
349 To have the script appear as a 'built-in' script, you write two simple
352 The 'record' script is a shell script with the same base name as your
353 script, but with -record appended. The shell script should be put
355 In that script, you write the 'perf record' command-line needed for
356 your script:
365 The 'report' script is also a shell script with the same base name as
366 your script, but with -report appended. It should also be located in
367 the perf/scripts/python/bin directory. In that script, you write the
368 'perf script -s' command-line needed for running your script:
375 perf script -s ~/libexec/perf-core/scripts/python/syscall-counts.py
378 Note that the location of the Python script given in the shell script
380 the script will be copied by 'make install' when you install perf.
381 For the installation to install your script there, your script needs
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'
400 should show a new entry for your script:
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
423 You can quickly get started writing a script for a particular set of
424 trace data by generating a skeleton script using 'perf script -g
426 That will generate a starter script containing a handler for each of
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
454 Traces meant to be processed using a script should be recorded with
507 write a useful trace script. The sections below cover the rest.
512 Every perf script Python script should start by setting up a Python
521 '/scripts/python/perf-script-Util/lib/Perf/Trace')
527 The rest of the script can contain handler functions and support
530 Aside from the event handler functions discussed above, every script
542 processed and gives scripts a chance to do end-of-script tasks, such
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]