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.
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
271 handler called at the end of script processing.
273 The final script producing the output shown above is shown in its
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
346 the script.
348 To have the script appear as a 'built-in' script, you write two simple
351 The 'record' script is a shell script with the same base name as your
352 script, but with -record appended. The shell script should be put
354 In that script, you write the 'perf record' command-line needed for
355 your script:
364 The 'report' script is also a shell script with the same base name as
365 your script, but with -report appended. It should also be located in
366 the perf/scripts/python/bin directory. In that script, you write the
367 'perf script -s' command-line needed for running your script:
374 perf script -s ~/libexec/perf-core/scripts/python/syscall-counts.py
377 Note that the location of the Python script given in the shell script
379 the script will be copied by 'make install' when you install perf.
380 For the installation to install your script there, your script needs
392 -rw-r--r-- 1 trz trz 2548 2010-01-26 22:29 check-perf-script.py
398 otherwise your script won't show up at run-time), 'perf script -l'
399 should show a new entry for your script:
402 root@tropicana:~# perf script -l
410 You can now perform the record step via 'perf script record':
412 # perf script record syscall-counts
414 and display the output using 'perf script report':
416 # perf script report syscall-counts
421 You can quickly get started writing a script for a particular set of
422 trace data by generating a skeleton script using 'perf script -g
424 That will generate a starter script containing a handler for each of
431 the check-perf-script.py script, while not interesting for its results,
437 When perf script is invoked using a trace script, a user-defined
452 Traces meant to be processed using a script should be recorded with
505 write a useful trace script. The sections below cover the rest.
510 Every perf script Python script should start by setting up a Python
525 The rest of the script can contain handler functions and support
528 Aside from the event handler functions discussed above, every script
540 processed and gives scripts a chance to do end-of-script tasks, such
559 built-in perf script Python modules and their associated functions.
565 via the various perf script Python modules. To use the functions and
567 import' line to your perf script script.
610 Various utility functions for use with perf script:
620 linkperf:perf-script[1]