History

perf scripting perl: Add common_callchain to fix argument order

Since common_callchain has been added to the argument array, we need to reflect it in perl-based scripts, because otherwise the following args would be shifted and thus incorrect. E.g. rw-by-pid and calculation of read and written bytes: Before: read counts by pid: pid comm # reads bytes_requested bytes_read ------ -------------------- ----------- ---------- ---------- 19301 dd 4 424510450039736 0 After: read counts by pid: pid comm # reads bytes_requested bytes_read ------ -------------------- ----------- ---------- ---------- 19301 dd 4 9536 4341 Committer testing: To see before after first do: # perf script record rw-by-pid ^C Now you'll have a perf.data file to report on, then do before and after using: # perf script report rw-by-pid Anbd notice the bytes_request/bytes_read, as above.

Michael Petlan committed 6 years ago

Commit 67439d51 parent ec2eab96 files · +20 −20Browse files

Unified · Split

6 files
  1. tools/perf/scripts/perl/check-perf-trace.pl +3 −3
  2. tools/perf/scripts/perl/failed-syscalls.pl +1 −1
  3. tools/perf/scripts/perl/rw-by-file.pl +3 −3
  4. tools/perf/scripts/perl/rw-by-pid.pl +5 −5
  5. tools/perf/scripts/perl/rwtop.pl +5 −5
  6. tools/perf/scripts/perl/wakeup-latency.pl +3 −3
tools/perf/scripts/perl/check-perf-trace.pl+3−3
@@ -28,7 +28,7 @@ sub trace_end · 27 unmodified lines
28sub irq::softirq_entry28sub irq::softirq_entry
29{29{
30 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,30 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
31 $common_pid, $common_comm,31 $common_pid, $common_comm, $common_callchain,
32 $vec) = @_;32 $vec) = @_;
33 33
34 print_header($event_name, $common_cpu, $common_secs, $common_nsecs,34 print_header($event_name, $common_cpu, $common_secs, $common_nsecs,
@@ -43,7 +43,7 @@ sub irq::softirq_entry · 8 unmodified lines
43sub kmem::kmalloc43sub kmem::kmalloc
44{44{
45 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,45 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
46 $common_pid, $common_comm,46 $common_pid, $common_comm, $common_callchain,
47 $call_site, $ptr, $bytes_req, $bytes_alloc,47 $call_site, $ptr, $bytes_req, $bytes_alloc,
48 $gfp_flags) = @_;48 $gfp_flags) = @_;
49 49
@@ -92,7 +92,7 @@ sub print_unhandled · 42 unmodified lines
92sub trace_unhandled92sub trace_unhandled
93{93{
94 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,94 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
95 $common_pid, $common_comm) = @_;95 $common_pid, $common_comm, $common_callchain) = @_;
96 96
97 $unhandled{$event_name}++;97 $unhandled{$event_name}++;
98}98}
tools/perf/scripts/perl/failed-syscalls.pl+1−1
@@ -18,7 +18,7 @@ my %failed_syscalls; · 17 unmodified lines
18sub raw_syscalls::sys_exit18sub raw_syscalls::sys_exit
19{19{
20 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,20 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
21 $common_pid, $common_comm,21 $common_pid, $common_comm, $common_callchain,
22 $id, $ret) = @_;22 $id, $ret) = @_;
23 23
24 if ($ret < 0) {24 if ($ret < 0) {
tools/perf/scripts/perl/rw-by-file.pl+3−3
@@ -28,7 +28,7 @@ my %writes; · 27 unmodified lines
28sub syscalls::sys_enter_read28sub syscalls::sys_enter_read
29{29{
30 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,30 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
31 $common_pid, $common_comm, $nr, $fd, $buf, $count) = @_;31 $common_pid, $common_comm, $common_callchain, $nr, $fd, $buf, $count) = @_;
32 32
33 if ($common_comm eq $for_comm) {33 if ($common_comm eq $for_comm) {
34 $reads{$fd}{bytes_requested} += $count;34 $reads{$fd}{bytes_requested} += $count;
@@ -39,7 +39,7 @@ sub syscalls::sys_enter_read · 4 unmodified lines
39sub syscalls::sys_enter_write39sub syscalls::sys_enter_write
40{40{
41 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,41 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
42 $common_pid, $common_comm, $nr, $fd, $buf, $count) = @_;42 $common_pid, $common_comm, $common_callchain, $nr, $fd, $buf, $count) = @_;
43 43
44 if ($common_comm eq $for_comm) {44 if ($common_comm eq $for_comm) {
45 $writes{$fd}{bytes_written} += $count;45 $writes{$fd}{bytes_written} += $count;
@@ -98,7 +98,7 @@ sub print_unhandled · 52 unmodified lines
98sub trace_unhandled98sub trace_unhandled
99{99{
100 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,100 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
101 $common_pid, $common_comm) = @_;101 $common_pid, $common_comm, $common_callchain) = @_;
102 102
103 $unhandled{$event_name}++;103 $unhandled{$event_name}++;
104}104}
tools/perf/scripts/perl/rw-by-pid.pl+5−5
@@ -24,7 +24,7 @@ my %writes; · 23 unmodified lines
24sub syscalls::sys_exit_read24sub syscalls::sys_exit_read
25{25{
26 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,26 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
27 $common_pid, $common_comm,27 $common_pid, $common_comm, $common_callchain,
28 $nr, $ret) = @_;28 $nr, $ret) = @_;
29 29
30 if ($ret > 0) {30 if ($ret > 0) {
@@ -40,7 +40,7 @@ sub syscalls::sys_exit_read · 9 unmodified lines
40sub syscalls::sys_enter_read40sub syscalls::sys_enter_read
41{41{
42 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,42 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
43 $common_pid, $common_comm,43 $common_pid, $common_comm, $common_callchain,
44 $nr, $fd, $buf, $count) = @_;44 $nr, $fd, $buf, $count) = @_;
45 45
46 $reads{$common_pid}{bytes_requested} += $count;46 $reads{$common_pid}{bytes_requested} += $count;
@@ -51,7 +51,7 @@ sub syscalls::sys_enter_read · 4 unmodified lines
51sub syscalls::sys_exit_write51sub syscalls::sys_exit_write
52{52{
53 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,53 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
54 $common_pid, $common_comm,54 $common_pid, $common_comm, $common_callchain,
55 $nr, $ret) = @_;55 $nr, $ret) = @_;
56 56
57 if ($ret <= 0) {57 if ($ret <= 0) {
@@ -62,7 +62,7 @@ sub syscalls::sys_exit_write · 4 unmodified lines
62sub syscalls::sys_enter_write62sub syscalls::sys_enter_write
63{63{
64 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,64 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
65 $common_pid, $common_comm,65 $common_pid, $common_comm, $common_callchain,
66 $nr, $fd, $buf, $count) = @_;66 $nr, $fd, $buf, $count) = @_;
67 67
68 $writes{$common_pid}{bytes_written} += $count;68 $writes{$common_pid}{bytes_written} += $count;
@@ -178,7 +178,7 @@ sub print_unhandled · 109 unmodified lines
178sub trace_unhandled178sub trace_unhandled
179{179{
180 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,180 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
181 $common_pid, $common_comm) = @_;181 $common_pid, $common_comm, $common_callchain) = @_;
182 182
183 $unhandled{$event_name}++;183 $unhandled{$event_name}++;
184}184}
tools/perf/scripts/perl/rwtop.pl+5−5
@@ -35,7 +35,7 @@ if (!$interval) { · 34 unmodified lines
35sub syscalls::sys_exit_read35sub syscalls::sys_exit_read
36{36{
37 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,37 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
38 $common_pid, $common_comm,38 $common_pid, $common_comm, $common_callchain,
39 $nr, $ret) = @_;39 $nr, $ret) = @_;
40 40
41 print_check();41 print_check();
@@ -53,7 +53,7 @@ sub syscalls::sys_exit_read · 11 unmodified lines
53sub syscalls::sys_enter_read53sub syscalls::sys_enter_read
54{54{
55 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,55 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
56 $common_pid, $common_comm,56 $common_pid, $common_comm, $common_callchain,
57 $nr, $fd, $buf, $count) = @_;57 $nr, $fd, $buf, $count) = @_;
58 58
59 print_check();59 print_check();
@@ -66,7 +66,7 @@ sub syscalls::sys_enter_read · 6 unmodified lines
66sub syscalls::sys_exit_write66sub syscalls::sys_exit_write
67{67{
68 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,68 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
69 $common_pid, $common_comm,69 $common_pid, $common_comm, $common_callchain,
70 $nr, $ret) = @_;70 $nr, $ret) = @_;
71 71
72 print_check();72 print_check();
@@ -79,7 +79,7 @@ sub syscalls::sys_exit_write · 6 unmodified lines
79sub syscalls::sys_enter_write79sub syscalls::sys_enter_write
80{80{
81 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,81 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
82 $common_pid, $common_comm,82 $common_pid, $common_comm, $common_callchain,
83 $nr, $fd, $buf, $count) = @_;83 $nr, $fd, $buf, $count) = @_;
84 84
85 print_check();85 print_check();
@@ -197,7 +197,7 @@ sub print_unhandled · 111 unmodified lines
197sub trace_unhandled197sub trace_unhandled
198{198{
199 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,199 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
200 $common_pid, $common_comm) = @_;200 $common_pid, $common_comm, $common_callchain) = @_;
201 201
202 $unhandled{$event_name}++;202 $unhandled{$event_name}++;
203}203}
tools/perf/scripts/perl/wakeup-latency.pl+3−3
@@ -28,7 +28,7 @@ my $total_wakeups = 0; · 27 unmodified lines
28sub sched::sched_switch28sub sched::sched_switch
29{29{
30 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,30 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
31 $common_pid, $common_comm,31 $common_pid, $common_comm, $common_callchain,
32 $prev_comm, $prev_pid, $prev_prio, $prev_state, $next_comm, $next_pid,32 $prev_comm, $prev_pid, $prev_prio, $prev_state, $next_comm, $next_pid,
33 $next_prio) = @_;33 $next_prio) = @_;
34 34
@@ -51,7 +51,7 @@ sub sched::sched_switch · 16 unmodified lines
51sub sched::sched_wakeup51sub sched::sched_wakeup
52{52{
53 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,53 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
54 $common_pid, $common_comm,54 $common_pid, $common_comm, $common_callchain,
55 $comm, $pid, $prio, $success, $target_cpu) = @_;55 $comm, $pid, $prio, $success, $target_cpu) = @_;
56 56
57 $last_wakeup{$target_cpu}{ts} = nsecs($common_secs, $common_nsecs);57 $last_wakeup{$target_cpu}{ts} = nsecs($common_secs, $common_nsecs);
@@ -101,7 +101,7 @@ sub print_unhandled · 43 unmodified lines
101sub trace_unhandled101sub trace_unhandled
102{102{
103 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,103 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
104 $common_pid, $common_comm) = @_;104 $common_pid, $common_comm, $common_callchain) = @_;
105 105
106 $unhandled{$event_name}++;106 $unhandled{$event_name}++;
107}107}