diff options
Diffstat (limited to 'tools/perf/scripts/perl')
17 files changed, 21 insertions, 167 deletions
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c index 01a64ad693f..790ceba6ad3 100644 --- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c +++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c @@ -8,7 +8,7 @@  #line 1 "Context.xs"  /* - * Context.xs.  XS interfaces for perf trace. + * Context.xs.  XS interfaces for perf script.   *   * Copyright (C) 2009 Tom Zanussi <tzanussi@gmail.com>   * diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs index 549cf0467d3..8c7ea42444d 100644 --- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs +++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs @@ -1,5 +1,5 @@  /* - * Context.xs.  XS interfaces for perf trace. + * Context.xs.  XS interfaces for perf script.   *   * Copyright (C) 2009 Tom Zanussi <tzanussi@gmail.com>   * diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/README b/tools/perf/scripts/perl/Perf-Trace-Util/README index 9a970763079..2f0c7f3043e 100644 --- a/tools/perf/scripts/perl/Perf-Trace-Util/README +++ b/tools/perf/scripts/perl/Perf-Trace-Util/README @@ -1,7 +1,7 @@  Perf-Trace-Util version 0.01  ============================ -This module contains utility functions for use with perf trace. +This module contains utility functions for use with perf script.  Core.pm and Util.pm are pure Perl modules; Core.pm contains routines  that the core perf support for Perl calls on and should always be @@ -33,7 +33,7 @@ After you do that:  INSTALLATION -Building perf with perf trace Perl scripting should install this +Building perf with perf script Perl scripting should install this  module in the right place.  You should make sure libperl and ExtUtils/Embed.pm are installed first diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Context.pm b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Context.pm index 6c7f3659cb1..4e2f6039ac9 100644 --- a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Context.pm +++ b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Context.pm @@ -34,7 +34,7 @@ Perf::Trace::Context - Perl extension for accessing functions in perf.  =head1 SEE ALSO -Perf (trace) documentation +Perf (script) documentation  =head1 AUTHOR diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Core.pm b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Core.pm index 9df376a9f62..9158458d3ee 100644 --- a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Core.pm +++ b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Core.pm @@ -163,7 +163,7 @@ sub dump_symbolic_fields  __END__  =head1 NAME -Perf::Trace::Core - Perl extension for perf trace +Perf::Trace::Core - Perl extension for perf script  =head1 SYNOPSIS @@ -171,7 +171,7 @@ Perf::Trace::Core - Perl extension for perf trace  =head1 SEE ALSO -Perf (trace) documentation +Perf (script) documentation  =head1 AUTHOR diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm index d94b40c8ac8..05350011462 100644 --- a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm +++ b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm @@ -65,7 +65,7 @@ sub clear_term  __END__  =head1 NAME -Perf::Trace::Util - Perl extension for perf trace +Perf::Trace::Util - Perl extension for perf script  =head1 SYNOPSIS @@ -73,7 +73,7 @@ Perf::Trace::Util - Perl extension for perf trace  =head1 SEE ALSO -Perf (trace) documentation +Perf (script) documentation  =head1 AUTHOR diff --git a/tools/perf/scripts/perl/bin/failed-syscalls-report b/tools/perf/scripts/perl/bin/failed-syscalls-report index 4028d92dc4a..9f83cc1ad8b 100644 --- a/tools/perf/scripts/perl/bin/failed-syscalls-report +++ b/tools/perf/scripts/perl/bin/failed-syscalls-report @@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then  	shift      fi  fi -perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/failed-syscalls.pl $comm +perf script $@ -s "$PERF_EXEC_PATH"/scripts/perl/failed-syscalls.pl $comm diff --git a/tools/perf/scripts/perl/bin/rw-by-file-report b/tools/perf/scripts/perl/bin/rw-by-file-report index ba25f4d41fb..77200b3f310 100644 --- a/tools/perf/scripts/perl/bin/rw-by-file-report +++ b/tools/perf/scripts/perl/bin/rw-by-file-report @@ -7,7 +7,4 @@ if [ $# -lt 1 ] ; then  fi  comm=$1  shift -perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-file.pl $comm - - - +perf script $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-file.pl $comm diff --git a/tools/perf/scripts/perl/bin/rw-by-pid-report b/tools/perf/scripts/perl/bin/rw-by-pid-report index 641a3f5d085..a27b9f311f9 100644 --- a/tools/perf/scripts/perl/bin/rw-by-pid-report +++ b/tools/perf/scripts/perl/bin/rw-by-pid-report @@ -1,6 +1,3 @@  #!/bin/bash  # description: system-wide r/w activity -perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-pid.pl - - - +perf script $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-pid.pl diff --git a/tools/perf/scripts/perl/bin/rwtop-report b/tools/perf/scripts/perl/bin/rwtop-report index 4918dba7702..83e11ec2e19 100644 --- a/tools/perf/scripts/perl/bin/rwtop-report +++ b/tools/perf/scripts/perl/bin/rwtop-report @@ -17,7 +17,4 @@ if [ "$n_args" -gt 0 ] ; then      interval=$1      shift  fi -perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rwtop.pl $interval - - - +perf script $@ -s "$PERF_EXEC_PATH"/scripts/perl/rwtop.pl $interval diff --git a/tools/perf/scripts/perl/bin/wakeup-latency-report b/tools/perf/scripts/perl/bin/wakeup-latency-report index 49052ebcb63..889e8130cca 100644 --- a/tools/perf/scripts/perl/bin/wakeup-latency-report +++ b/tools/perf/scripts/perl/bin/wakeup-latency-report @@ -1,6 +1,3 @@  #!/bin/bash  # description: system-wide min/max/avg wakeup latency -perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/wakeup-latency.pl - - - +perf script $@ -s "$PERF_EXEC_PATH"/scripts/perl/wakeup-latency.pl diff --git a/tools/perf/scripts/perl/bin/workqueue-stats-record b/tools/perf/scripts/perl/bin/workqueue-stats-record deleted file mode 100644 index 8edda9078d5..00000000000 --- a/tools/perf/scripts/perl/bin/workqueue-stats-record +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -perf record -e workqueue:workqueue_creation -e workqueue:workqueue_destruction -e workqueue:workqueue_execution -e workqueue:workqueue_insertion $@ diff --git a/tools/perf/scripts/perl/bin/workqueue-stats-report b/tools/perf/scripts/perl/bin/workqueue-stats-report deleted file mode 100644 index df0c65f4ca9..00000000000 --- a/tools/perf/scripts/perl/bin/workqueue-stats-report +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# description: workqueue stats (ins/exe/create/destroy) -perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/workqueue-stats.pl - - - - diff --git a/tools/perf/scripts/perl/check-perf-trace.pl b/tools/perf/scripts/perl/check-perf-trace.pl index 4e7dc0a407a..4e7076c2061 100644 --- a/tools/perf/scripts/perl/check-perf-trace.pl +++ b/tools/perf/scripts/perl/check-perf-trace.pl @@ -1,4 +1,4 @@ -# perf trace event handlers, generated by perf trace -g perl +# perf script event handlers, generated by perf script -g perl  # (c) 2009, Tom Zanussi <tzanussi@gmail.com>  # Licensed under the terms of the GNU GPL License version 2 diff --git a/tools/perf/scripts/perl/rw-by-file.pl b/tools/perf/scripts/perl/rw-by-file.pl index 2a39097687b..74844ee2be3 100644 --- a/tools/perf/scripts/perl/rw-by-file.pl +++ b/tools/perf/scripts/perl/rw-by-file.pl @@ -18,7 +18,7 @@ use lib "./Perf-Trace-Util/lib";  use Perf::Trace::Core;  use Perf::Trace::Util; -my $usage = "perf trace -s rw-by-file.pl <comm>\n"; +my $usage = "perf script -s rw-by-file.pl <comm>\n";  my $for_comm = shift or die $usage; diff --git a/tools/perf/scripts/perl/rwtop.pl b/tools/perf/scripts/perl/rwtop.pl index 4bb3ecd3347..8b20787021c 100644 --- a/tools/perf/scripts/perl/rwtop.pl +++ b/tools/perf/scripts/perl/rwtop.pl @@ -17,6 +17,7 @@ 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::Util; +use POSIX qw/SIGALRM SA_RESTART/;  my $default_interval = 3;  my $nlines = 20; @@ -90,7 +91,10 @@ sub syscalls::sys_enter_write  sub trace_begin  { -    $SIG{ALRM} = \&set_print_pending; +    my $sa = POSIX::SigAction->new(\&set_print_pending); +    $sa->flags(SA_RESTART); +    $sa->safe(1); +    POSIX::sigaction(SIGALRM, $sa) or die "Can't set SIGALRM handler: $!\n";      alarm 1;  } diff --git a/tools/perf/scripts/perl/workqueue-stats.pl b/tools/perf/scripts/perl/workqueue-stats.pl deleted file mode 100644 index b84b12699b7..00000000000 --- a/tools/perf/scripts/perl/workqueue-stats.pl +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/perl -w -# (c) 2009, Tom Zanussi <tzanussi@gmail.com> -# Licensed under the terms of the GNU GPL License version 2 - -# Displays workqueue stats -# -# Usage: -# -#   perf record -c 1 -f -a -R -e workqueue:workqueue_creation -e -#     workqueue:workqueue_destruction -e workqueue:workqueue_execution -#     -e workqueue:workqueue_insertion -# -#   perf trace -p -s tools/perf/scripts/perl/workqueue-stats.pl - -use 5.010000; -use strict; -use warnings; - -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::Util; - -my @cpus; - -sub workqueue::workqueue_destruction -{ -    my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs, -	$common_pid, $common_comm, -	$thread_comm, $thread_pid) = @_; - -    $cpus[$common_cpu]{$thread_pid}{destroyed}++; -    $cpus[$common_cpu]{$thread_pid}{comm} = $thread_comm; -} - -sub workqueue::workqueue_creation -{ -    my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs, -	$common_pid, $common_comm, -	$thread_comm, $thread_pid, $cpu) = @_; - -    $cpus[$common_cpu]{$thread_pid}{created}++; -    $cpus[$common_cpu]{$thread_pid}{comm} = $thread_comm; -} - -sub workqueue::workqueue_execution -{ -    my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs, -	$common_pid, $common_comm, -	$thread_comm, $thread_pid, $func) = @_; - -    $cpus[$common_cpu]{$thread_pid}{executed}++; -    $cpus[$common_cpu]{$thread_pid}{comm} = $thread_comm; -} - -sub workqueue::workqueue_insertion -{ -    my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs, -	$common_pid, $common_comm, -	$thread_comm, $thread_pid, $func) = @_; - -    $cpus[$common_cpu]{$thread_pid}{inserted}++; -    $cpus[$common_cpu]{$thread_pid}{comm} = $thread_comm; -} - -sub trace_end -{ -    print "workqueue work stats:\n\n"; -    my $cpu = 0; -    printf("%3s %6s %6s\t%-20s\n", "cpu", "ins", "exec", "name"); -    printf("%3s %6s %6s\t%-20s\n", "---", "---", "----", "----"); -    foreach my $pidhash (@cpus) { -	while ((my $pid, my $wqhash) = each %$pidhash) { -	    my $ins = $$wqhash{'inserted'} || 0; -	    my $exe = $$wqhash{'executed'} || 0; -	    my $comm = $$wqhash{'comm'} || ""; -	    if ($ins || $exe) { -		printf("%3u %6u %6u\t%-20s\n", $cpu, $ins, $exe, $comm); -	    } -	} -	$cpu++; -    } - -    $cpu = 0; -    print "\nworkqueue lifecycle stats:\n\n"; -    printf("%3s %6s %6s\t%-20s\n", "cpu", "created", "destroyed", "name"); -    printf("%3s %6s %6s\t%-20s\n", "---", "-------", "---------", "----"); -    foreach my $pidhash (@cpus) { -	while ((my $pid, my $wqhash) = each %$pidhash) { -	    my $created = $$wqhash{'created'} || 0; -	    my $destroyed = $$wqhash{'destroyed'} || 0; -	    my $comm = $$wqhash{'comm'} || ""; -	    if ($created || $destroyed) { -		printf("%3u %6u %6u\t%-20s\n", $cpu, $created, $destroyed, -		       $comm); -	    } -	} -	$cpu++; -    } - -    print_unhandled(); -} - -my %unhandled; - -sub print_unhandled -{ -    if ((scalar keys %unhandled) == 0) { -	return; -    } - -    print "\nunhandled events:\n\n"; - -    printf("%-40s  %10s\n", "event", "count"); -    printf("%-40s  %10s\n", "----------------------------------------", -	   "-----------"); - -    foreach my $event_name (keys %unhandled) { -	printf("%-40s  %10d\n", $event_name, $unhandled{$event_name}); -    } -} - -sub trace_unhandled -{ -    my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs, -	$common_pid, $common_comm) = @_; - -    $unhandled{$event_name}++; -}  | 
