From 8e4bff4cab0ddac6060645b0715210484d02ff40 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Wed, 30 Aug 2017 08:25:59 +0000 Subject: Initial file dump from open source release --- tools/perf/scripts/perl/failed-syscalls.pl | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tools/perf/scripts/perl/failed-syscalls.pl (limited to 'tools/perf/scripts/perl/failed-syscalls.pl') diff --git a/tools/perf/scripts/perl/failed-syscalls.pl b/tools/perf/scripts/perl/failed-syscalls.pl new file mode 100644 index 00000000..94bc25a3 --- /dev/null +++ b/tools/perf/scripts/perl/failed-syscalls.pl @@ -0,0 +1,42 @@ +# failed system call counts +# (c) 2010, Tom Zanussi +# 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, + $id, $ret) = @_; + + if ($ret < 0) { + $failed_syscalls{$common_comm}++; + } +} + +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}); + } +} -- cgit v1.3.1