[PATCH 0/6] perf trace/scripting updates

Tom Zanussi
2009-12-15T08:53:47Z

This patchset fixes a few oversights and adds some options to aid
usability.

With these patches, the list of available trace scripts can be easily
displayed, and the script names shown in the list can be used to
record and invoke the individual scripts without forcing the user to
remember and enter long command-lines.

For example, getting r/w activity for a program e.g. firefox is as
easy as running 'perf trace -l', noting that the rw-by-file script
exists, and using that name to record data and display the results
using 'perf trace record rw-by-file' and 'perf trace report rw-by-file
firefox':

root@tropicana:~# perf trace -l
List of available trace scripts:
workqueue-stats workqueue stats (ins/exe/create/destroy)
wakeup-latency system-wide min/max/avg wakeup latency
rw-by-file <comm> r/w activity for a program, by file
check-perf-trace useless but exhaustive test script
rw-by-pid system-wide r/w activity

root@tropicana:~# perf trace record rw-by-file
^C[ perf record: Woken up 2 times to write data ]
[ perf record: Captured and wrote 65.388 MB perf.data (~2856833 samples) ]

root@tropicana:~# perf trace report rw-by-file firefox
perf trace started with Perl script /root/libexec/perf-core/scripts/perl/rw-by-file.pl

file read counts for firefox:

fd # reads bytes_requested
------ ---------- -----------
3 3796 15548416
45 12 33075
32 28 28672
16 20 20480
58 6 17279
22 4 16384
46 2 11289
57 2 8192
26 2 8192
60 2 8192
47 5 4160
12 78 3874
44 2 606
19 179 179
42 8 128
53 1 16

file write counts for firefox:

fd # writes bytes_written
------ ---------- -----------
52 51 55528
26 13 53248
55 22 45100
45 8 23632
42 19 19456
59 28 10304
58 24 8760
61 1 7988
57 13 4640
20 179 179
33 28 28
17 26 26

Note that the perf trace -l option was previously used to display
latency information; this patchset changes that option to -L in the
interest of maintaining consistency with other perf -l options.

The other patches in this patchset fix some oversights, including
adding support for script args, which entails a change to
scripting_ops.

Tom Zanussi (6):
perf trace/scripting: add support for script args
perf trace/scripting: don't install unneeded files
perf trace/scripting: check return val of perl_run()
perf trace/scripting: list available scripts
perf trace/scripting: add 'record' and 'report' options
perf trace/scripting: update Documentation

tools/perf/Documentation/perf-trace.txt | 27 ++-
tools/perf/Makefile | 2 -
tools/perf/builtin-trace.c | 302 +++++++++++++++++++-
.../perf/scripts/perl/bin/check-perf-trace-report | 1 +
tools/perf/scripts/perl/bin/rw-by-file-report | 4 +-
tools/perf/scripts/perl/bin/rw-by-pid-report | 1 +
tools/perf/scripts/perl/bin/wakeup-latency-report | 1 +
tools/perf/scripts/perl/bin/workqueue-stats-report | 1 +
tools/perf/scripts/perl/rw-by-file.pl | 5 +-
tools/perf/util/trace-event-perl.c | 42 ++-
tools/perf/util/trace-event.h | 2 +-
11 files changed, 356 insertions(+), 32 deletions(-)