2010-01-27 15:27:58 +07:00
|
|
|
# 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;
|
|
|
|
|
2010-05-10 11:46:52 +07:00
|
|
|
my $for_comm = shift;
|
|
|
|
|
2010-01-27 15:27:58 +07:00
|
|
|
my %failed_syscalls;
|
|
|
|
|
|
|
|
sub raw_syscalls::sys_exit
|
|
|
|
{
|
|
|
|
my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
|
|
|
|
$common_pid, $common_comm,
|
|
|
|
$id, $ret) = @_;
|
|
|
|
|
|
|
|
if ($ret < 0) {
|
|
|
|
$failed_syscalls{$common_comm}++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-12 02:09:08 +07:00
|
|
|
sub syscalls::sys_exit
|
|
|
|
{
|
|
|
|
raw_syscalls::sys_exit(@_)
|
|
|
|
}
|
|
|
|
|
2010-01-27 15:27:58 +07:00
|
|
|
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) {
|
2010-05-10 11:46:52 +07:00
|
|
|
next if ($for_comm && $comm ne $for_comm);
|
|
|
|
|
|
|
|
printf("%-20s %10s\n", $comm, $failed_syscalls{$comm});
|
2010-01-27 15:27:58 +07:00
|
|
|
}
|
|
|
|
}
|