67439d555f
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 <mpetlan@redhat.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Benjamin Salon <bsalon@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> LPU-Reference: 20200311132836.12693-1-mpetlan@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
48 lines
1.1 KiB
Raku
48 lines
1.1 KiB
Raku
# failed system call counts
|
|
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
|
|
# Licensed under the terms of the GNU GPL License version 2
|
|
#
|
|
# Displays system-wide failed system call totals
|
|
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
|
|
|
|
use lib "$ENV{'PERF_EXEC_PATH'}/scripts/perl/Perf-Trace-Util/lib";
|
|
use lib "./Perf-Trace-Util/lib";
|
|
use Perf::Trace::Core;
|
|
use Perf::Trace::Context;
|
|
use Perf::Trace::Util;
|
|
|
|
my $for_comm = shift;
|
|
|
|
my %failed_syscalls;
|
|
|
|
sub raw_syscalls::sys_exit
|
|
{
|
|
my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
|
|
$common_pid, $common_comm, $common_callchain,
|
|
$id, $ret) = @_;
|
|
|
|
if ($ret < 0) {
|
|
$failed_syscalls{$common_comm}++;
|
|
}
|
|
}
|
|
|
|
sub syscalls::sys_exit
|
|
{
|
|
raw_syscalls::sys_exit(@_)
|
|
}
|
|
|
|
sub trace_end
|
|
{
|
|
printf("\nfailed syscalls by comm:\n\n");
|
|
|
|
printf("%-20s %10s\n", "comm", "# errors");
|
|
printf("%-20s %6s %10s\n", "--------------------", "----------");
|
|
|
|
foreach my $comm (sort {$failed_syscalls{$b} <=> $failed_syscalls{$a}}
|
|
keys %failed_syscalls) {
|
|
next if ($for_comm && $comm ne $for_comm);
|
|
|
|
printf("%-20s %10s\n", $comm, $failed_syscalls{$comm});
|
|
}
|
|
}
|