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.
161 path append which every perf script script should include.
165 script respectively (for more details, see the SCRIPT_LAYOUT section
176 generated for every script. The first, trace_unhandled(), is called
177 every time the script finds an event in the perf.data file that
178 doesn't correspond to any event handler in the script. This could
180 really interested in, or the script was run against a trace file that
181 doesn't correspond to the script.
183 The script generated by -g option simply prints a line for each
187 script and run it to see the default output:
190 # mv perf-script.py syscall-counts.py
191 # perf script -s syscall-counts.py
206 Of course, for this script, we're not interested in printing every
269 handler called at the end of script processing.
271 The final script producing the output shown above is shown in its
314 The script can be run just as before:
316 # perf script -s syscall-counts.py
318 So those are the essential steps in writing and running a script. The
325 generate a skeleton script using 'perf script -g python' and modify the
328 After you've done that you may end up with a general-purpose script
331 right place, you can have your script listed alongside the other
332 scripts listed by the 'perf script -l' command e.g.:
335 # perf script -l
344 the script.
346 To have the script appear as a 'built-in' script, you write two simple
349 The 'record' script is a shell script with the same base name as your
350 script, but with -record appended. The shell script should be put
352 In that script, you write the 'perf record' command-line needed for
353 your script:
362 The 'report' script is also a shell script with the same base name as
363 your script, but with -report appended. It should also be located in
364 the perf/scripts/python/bin directory. In that script, you write the
365 'perf script -s' command-line needed for running your script:
372 perf script -s ~/libexec/perf-core/scripts/python/syscall-counts.py
375 Note that the location of the Python script given in the shell script
377 the script will be copied by 'make install' when you install perf.
378 For the installation to install your script there, your script needs
388 -rw-r--r-- 1 trz trz 2548 2010-01-26 22:29 check-perf-script.py
394 otherwise your script won't show up at run-time), 'perf script -l'
395 should show a new entry for your script:
398 # perf script -l
406 You can now perform the record step via 'perf script record':
408 # perf script record syscall-counts
410 and display the output using 'perf script report':
412 # perf script report syscall-counts
417 You can quickly get started writing a script for a particular set of
418 trace data by generating a skeleton script using 'perf script -g
420 That will generate a starter script containing a handler for each of
427 the check-perf-script.py script, while not interesting for its results,
433 When perf script is invoked using a trace script, a user-defined
448 Traces meant to be processed using a script should be recorded with
501 write a useful trace script. The sections below cover the rest.
506 Every perf script Python script should start by setting up a Python
521 The rest of the script can contain handler functions and support
524 Aside from the event handler functions discussed above, every script
536 processed and gives scripts a chance to do end-of-script tasks, such
575 built-in perf script Python modules and their associated functions.
581 via the various perf script Python modules. To use the functions and
583 import' line to your perf script script.
632 Various utility functions for use with perf script:
679 linkperf:perf-script[1]