Path: blob/master/tools/perf/scripts/perl/failed-syscalls.pl
10823 views
# failed system call counts1# (c) 2010, Tom Zanussi <[email protected]>2# Licensed under the terms of the GNU GPL License version 23#4# Displays system-wide failed system call totals5# If a [comm] arg is specified, only syscalls called by [comm] are displayed.67use lib "$ENV{'PERF_EXEC_PATH'}/scripts/perl/Perf-Trace-Util/lib";8use lib "./Perf-Trace-Util/lib";9use Perf::Trace::Core;10use Perf::Trace::Context;11use Perf::Trace::Util;1213my $for_comm = shift;1415my %failed_syscalls;1617sub raw_syscalls::sys_exit18{19my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,20$common_pid, $common_comm,21$id, $ret) = @_;2223if ($ret < 0) {24$failed_syscalls{$common_comm}++;25}26}2728sub trace_end29{30printf("\nfailed syscalls by comm:\n\n");3132printf("%-20s %10s\n", "comm", "# errors");33printf("%-20s %6s %10s\n", "--------------------", "----------");3435foreach my $comm (sort {$failed_syscalls{$b} <=> $failed_syscalls{$a}}36keys %failed_syscalls) {37next if ($for_comm && $comm ne $for_comm);3839printf("%-20s %10s\n", $comm, $failed_syscalls{$comm});40}41}424344