summaryrefslogtreecommitdiffstats
path: root/lib/cpu_rmap.c
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2011-12-15 18:23:43 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-12-23 20:05:48 +0100
commit37a058ea006de0cc24553637afa788594a975176 (patch)
treebdd928cd0938bd8e6fdacbb4cdaeaf6d4b83ec70 /lib/cpu_rmap.c
parentperf tools: Use for_each_set_bit() to iterate over feature flags (diff)
downloadlinux-37a058ea006de0cc24553637afa788594a975176.tar.xz
linux-37a058ea006de0cc24553637afa788594a975176.zip
perf script: Add generic perl handler to process events
The current perf scripting facility only supports tracepoints. This patch implements a generic perl handler to support other events than tracepoints too. This patch introduces a function process_event() that is called by perf for each sample. The function is called with byte streams as arguments containing information about the event, its attributes, the sample and raw data. Perl's unpack() function can easily be used for byte decoding. The following is the default implementation for process_event() that can also be generated with perf script: # Packed byte string args of process_event(): # # $event: union perf_event util/event.h # $attr: struct perf_event_attr linux/perf_event.h # $sample: struct perf_sample util/event.h # $raw_data: perf_sample->raw_data util/event.h sub process_event { my ($event, $attr, $sample, $raw_data) = @_; my @event = unpack("LSS", $event); my @attr = unpack("LLQQQQQLLQQ", $attr); my @sample = unpack("QLLQQQQQLL", $sample); my @raw_data = unpack("C*", $raw_data); use Data::Dumper; print Dumper \@event, \@attr, \@sample, \@raw_data; } Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1323969824-9711-4-git-send-email-robert.richter@amd.com Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'lib/cpu_rmap.c')
0 files changed, 0 insertions, 0 deletions