1 # perf trace event handlers, generated by perf trace -g perl
2 # (c) 2009, Tom Zanussi <tzanussi@gmail.com>
3 # Licensed under the terms of the GNU GPL License version 2
5 # This script tests basic functionality such as flag and symbol
6 # strings, common_xxx() calls back into perf, begin, end, unhandled
7 # events, etc. Basically, if this script runs successfully and
8 # displays expected results, perl scripting support should be ok.
10 use lib
"$ENV{'PERF_EXEC_PATH'}/scripts/perl/Perf-Trace-Util/lib";
11 use lib
"./Perf-Trace-Util/lib";
12 use Perf
::Trace
::Core
;
13 use Perf
::Trace
::Context
;
14 use Perf
::Trace
::Util
;
18 print "trace_begin\n";
28 sub irq
::softirq_entry
30 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
31 $common_pid, $common_comm,
34 print_header
($event_name, $common_cpu, $common_secs, $common_nsecs,
35 $common_pid, $common_comm);
37 print_uncommon
($context);
40 symbol_str
("irq::softirq_entry", "vec", $vec));
45 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
46 $common_pid, $common_comm,
47 $call_site, $ptr, $bytes_req, $bytes_alloc,
50 print_header
($event_name, $common_cpu, $common_secs, $common_nsecs,
51 $common_pid, $common_comm);
53 print_uncommon
($context);
55 printf("call_site=%p, ptr=%p, bytes_req=%u, bytes_alloc=%u, ".
57 $call_site, $ptr, $bytes_req, $bytes_alloc,
59 flag_str
("kmem::kmalloc", "gfp_flags", $gfp_flags));
62 # print trace fields not included in handler args
67 printf("common_preempt_count=%d, common_flags=%s, common_lock_depth=%d, ",
68 common_pc
($context), trace_flag_str
(common_flags
($context)),
69 common_lock_depth
($context));
77 if ((scalar keys %unhandled) == 0) {
81 print "\nunhandled events:\n\n";
83 printf("%-40s %10s\n", "event", "count");
84 printf("%-40s %10s\n", "----------------------------------------",
87 foreach my $event_name (keys %unhandled) {
88 printf("%-40s %10d\n", $event_name, $unhandled{$event_name});
94 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
95 $common_pid, $common_comm) = @_;
97 $unhandled{$event_name}++;
102 my ($event_name, $cpu, $secs, $nsecs, $pid, $comm) = @_;
104 printf("%-20s %5u %05u.%09u %8u %-20s ",
105 $event_name, $cpu, $secs, $nsecs, $pid, $comm);