Skip to content

Commit 67439d5

Browse files
rfmvhacmel
authored andcommitted
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. Signed-off-by: Michael Petlan <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Cc: Benjamin Salon <[email protected]> Cc: Jiri Olsa <[email protected]> LPU-Reference: [email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent ec2eab9 commit 67439d5

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

tools/perf/scripts/perl/check-perf-trace.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ sub trace_end
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
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
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
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
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
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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
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
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
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
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
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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
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
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
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
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
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
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
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
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
}

0 commit comments

Comments
 (0)