Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) # failed system call counts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) # (c) 2010, Tom Zanussi <tzanussi@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) # Licensed under the terms of the GNU GPL License version 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) # Displays system-wide failed system call totals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) # If a [comm] arg is specified, only syscalls called by [comm] are displayed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) use lib "$ENV{'PERF_EXEC_PATH'}/scripts/perl/Perf-Trace-Util/lib";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) use lib "./Perf-Trace-Util/lib";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) use Perf::Trace::Core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) use Perf::Trace::Context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) use Perf::Trace::Util;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) my $for_comm = shift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) my %failed_syscalls;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) sub raw_syscalls::sys_exit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	    $common_pid, $common_comm, $common_callchain,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	    $id, $ret) = @_;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	if ($ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	    $failed_syscalls{$common_comm}++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) sub syscalls::sys_exit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	raw_syscalls::sys_exit(@_)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) sub trace_end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)     printf("\nfailed syscalls by comm:\n\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)     printf("%-20s  %10s\n", "comm", "# errors");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)     printf("%-20s  %6s  %10s\n", "--------------------", "----------");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)     foreach my $comm (sort {$failed_syscalls{$b} <=> $failed_syscalls{$a}}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		      keys %failed_syscalls) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	next if ($for_comm && $comm ne $for_comm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	printf("%-20s  %10s\n", $comm, $failed_syscalls{$comm});
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)     }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) }