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
2828 sub irq::softirq_entry
2929 {
3030 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
31− $common_pid, $common_comm,
31+ $common_pid, $common_comm, $common_callchain,
3232 $vec) = @_;
3333
3434 print_header($event_name, $common_cpu, $common_secs, $common_nsecs,
@@ -43,7 +43,7 @@ sub irq::softirq_entry · 8 unmodified lines
4343 sub kmem::kmalloc
4444 {
4545 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
46− $common_pid, $common_comm,
46+ $common_pid, $common_comm, $common_callchain,
4747 $call_site, $ptr, $bytes_req, $bytes_alloc,
4848 $gfp_flags) = @_;
4949
@@ -92,7 +92,7 @@ sub print_unhandled · 42 unmodified lines
9292 sub trace_unhandled
9393 {
9494 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
95− $common_pid, $common_comm) = @_;
95+ $common_pid, $common_comm, $common_callchain) = @_;
9696
9797 $unhandled{$event_name}++;
9898 }
tools/perf/scripts/perl/failed-syscalls.pl+1−1
@@ -18,7 +18,7 @@ my %failed_syscalls; · 17 unmodified lines
1818 sub raw_syscalls::sys_exit
1919 {
2020 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
21− $common_pid, $common_comm,
21+ $common_pid, $common_comm, $common_callchain,
2222 $id, $ret) = @_;
2323
2424 if ($ret < 0) {
tools/perf/scripts/perl/rw-by-file.pl+3−3
@@ -28,7 +28,7 @@ my %writes; · 27 unmodified lines
2828 sub syscalls::sys_enter_read
2929 {
3030 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) = @_;
3232
3333 if ($common_comm eq $for_comm) {
3434 $reads{$fd}{bytes_requested} += $count;
@@ -39,7 +39,7 @@ sub syscalls::sys_enter_read · 4 unmodified lines
3939 sub syscalls::sys_enter_write
4040 {
4141 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) = @_;
4343
4444 if ($common_comm eq $for_comm) {
4545 $writes{$fd}{bytes_written} += $count;
@@ -98,7 +98,7 @@ sub print_unhandled · 52 unmodified lines
9898 sub trace_unhandled
9999 {
100100 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
101− $common_pid, $common_comm) = @_;
101+ $common_pid, $common_comm, $common_callchain) = @_;
102102
103103 $unhandled{$event_name}++;
104104 }
tools/perf/scripts/perl/rw-by-pid.pl+5−5
@@ -24,7 +24,7 @@ my %writes; · 23 unmodified lines
2424 sub syscalls::sys_exit_read
2525 {
2626 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
27− $common_pid, $common_comm,
27+ $common_pid, $common_comm, $common_callchain,
2828 $nr, $ret) = @_;
2929
3030 if ($ret > 0) {
@@ -40,7 +40,7 @@ sub syscalls::sys_exit_read · 9 unmodified lines
4040 sub syscalls::sys_enter_read
4141 {
4242 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
43− $common_pid, $common_comm,
43+ $common_pid, $common_comm, $common_callchain,
4444 $nr, $fd, $buf, $count) = @_;
4545
4646 $reads{$common_pid}{bytes_requested} += $count;
@@ -51,7 +51,7 @@ sub syscalls::sys_enter_read · 4 unmodified lines
5151 sub syscalls::sys_exit_write
5252 {
5353 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
54− $common_pid, $common_comm,
54+ $common_pid, $common_comm, $common_callchain,
5555 $nr, $ret) = @_;
5656
5757 if ($ret <= 0) {
@@ -62,7 +62,7 @@ sub syscalls::sys_exit_write · 4 unmodified lines
6262 sub syscalls::sys_enter_write
6363 {
6464 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
65− $common_pid, $common_comm,
65+ $common_pid, $common_comm, $common_callchain,
6666 $nr, $fd, $buf, $count) = @_;
6767
6868 $writes{$common_pid}{bytes_written} += $count;
@@ -178,7 +178,7 @@ sub print_unhandled · 109 unmodified lines
178178 sub trace_unhandled
179179 {
180180 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
181− $common_pid, $common_comm) = @_;
181+ $common_pid, $common_comm, $common_callchain) = @_;
182182
183183 $unhandled{$event_name}++;
184184 }
tools/perf/scripts/perl/rwtop.pl+5−5
@@ -35,7 +35,7 @@ if (!$interval) { · 34 unmodified lines
3535 sub syscalls::sys_exit_read
3636 {
3737 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
38− $common_pid, $common_comm,
38+ $common_pid, $common_comm, $common_callchain,
3939 $nr, $ret) = @_;
4040
4141 print_check();
@@ -53,7 +53,7 @@ sub syscalls::sys_exit_read · 11 unmodified lines
5353 sub syscalls::sys_enter_read
5454 {
5555 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
56− $common_pid, $common_comm,
56+ $common_pid, $common_comm, $common_callchain,
5757 $nr, $fd, $buf, $count) = @_;
5858
5959 print_check();
@@ -66,7 +66,7 @@ sub syscalls::sys_enter_read · 6 unmodified lines
6666 sub syscalls::sys_exit_write
6767 {
6868 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
69− $common_pid, $common_comm,
69+ $common_pid, $common_comm, $common_callchain,
7070 $nr, $ret) = @_;
7171
7272 print_check();
@@ -79,7 +79,7 @@ sub syscalls::sys_exit_write · 6 unmodified lines
7979 sub syscalls::sys_enter_write
8080 {
8181 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
82− $common_pid, $common_comm,
82+ $common_pid, $common_comm, $common_callchain,
8383 $nr, $fd, $buf, $count) = @_;
8484
8585 print_check();
@@ -197,7 +197,7 @@ sub print_unhandled · 111 unmodified lines
197197 sub trace_unhandled
198198 {
199199 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
200− $common_pid, $common_comm) = @_;
200+ $common_pid, $common_comm, $common_callchain) = @_;
201201
202202 $unhandled{$event_name}++;
203203 }
tools/perf/scripts/perl/wakeup-latency.pl+3−3
@@ -28,7 +28,7 @@ my $total_wakeups = 0; · 27 unmodified lines
2828 sub sched::sched_switch
2929 {
3030 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
31− $common_pid, $common_comm,
31+ $common_pid, $common_comm, $common_callchain,
3232 $prev_comm, $prev_pid, $prev_prio, $prev_state, $next_comm, $next_pid,
3333 $next_prio) = @_;
3434
@@ -51,7 +51,7 @@ sub sched::sched_switch · 16 unmodified lines
5151 sub sched::sched_wakeup
5252 {
5353 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
54− $common_pid, $common_comm,
54+ $common_pid, $common_comm, $common_callchain,
5555 $comm, $pid, $prio, $success, $target_cpu) = @_;
5656
5757 $last_wakeup{$target_cpu}{ts} = nsecs($common_secs, $common_nsecs);
@@ -101,7 +101,7 @@ sub print_unhandled · 43 unmodified lines
101101 sub trace_unhandled
102102 {
103103 my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
104− $common_pid, $common_comm) = @_;
104+ $common_pid, $common_comm, $common_callchain) = @_;
105105
106106 $unhandled{$event_name}++;
107107 }