The structure of the script is to measure TLB misses of a specific PID or a target application. There are cases when we want to monitor globally because there are a large number of interacting applications and we want a big picture view. This patch implements a --target-global switch to report on global events.
Signed-off-by: Mel Gorman <m...@csn.ul.ie> --- TLBC/OpCollect.pm | 7 +++++-- TLBC/PerfCollect.pm | 2 +- cpupcstat | 8 +++++++- man/cpupcstat.8 | 5 +++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/TLBC/OpCollect.pm b/TLBC/OpCollect.pm index 9066099..2a1c006 100644 --- a/TLBC/OpCollect.pm +++ b/TLBC/OpCollect.pm @@ -154,7 +154,10 @@ sub get_current_eventcount() $col = $self->_get_column($event); foreach $line (@results) { - if ($line =~ /$binName/) { + if ($line !~ /^\s+[0-9]/) { + next; + } + if ($binName eq "/" || $line =~ /$binName/) { chomp($line); $line =~ s/^\s+//; $line =~ s/\s+$//; @@ -169,7 +172,7 @@ sub get_current_eventcount() sub read_eventcount() { system("opcontrol --dump > /dev/null 2>&1"); - $report = `opreport`; + $report = `opreport -x`; } sub shutdown() diff --git a/TLBC/PerfCollect.pm b/TLBC/PerfCollect.pm index e28fb2c..f44d920 100644 --- a/TLBC/PerfCollect.pm +++ b/TLBC/PerfCollect.pm @@ -111,7 +111,7 @@ sub get_current_eventcount() } foreach $line (@lines) { - if ($line =~ /$binName/) { + if ($binName eq "/" || $line =~ /$binName/) { chomp($line); $line =~ s/^\s+//; $line =~ s/\s+$//; diff --git a/cpupcstat b/cpupcstat index ff6216c..c4a1795 100755 --- a/cpupcstat +++ b/cpupcstat @@ -18,6 +18,7 @@ my $vmlinux; my $target; my $real_target; my $target_pid; +my $target_global; my $misses; my $instructions = 0; my $cycles = 0; @@ -105,6 +106,9 @@ sub run_profile() $binName = $results[0]; } $pid = start_target(); + } elsif (defined $target_global) { + $binName='/'; + $pid = $$; } $binName = `basename $binName`; @@ -206,6 +210,7 @@ sub print_usage() --vmlinux /path/to/vmlinux Sets the vmlinux file to use --delay N Waits N seconds before rereading the miss rate + --target-global Watch the miss rate of all processes --target-pid P Watch the miss rate of P instead of a target --real-target T Watch T instead of target in case target is a launcher script @@ -236,6 +241,7 @@ Getopt::Long::Configure ('bundling'); GetOptions ('v|vmlinux=s' => \$vmlinux, 'h|help' => \&print_usage, 'd|delay=i' => \$wait_time, + 'g|target-global' => \$target_global, 'p|target-pid=i' => \$target_pid, 'r|real-target=s' => \$real_target, 'l|time-limit=i' => \$time_limit, @@ -248,7 +254,7 @@ GetOptions ('v|vmlinux=s' => \$vmlinux, 's|persist' => \$persist, '<>' => \&get_target); -if (!$target && not defined $target_pid) { +if (!$target && !$target_global && not defined $target_pid) { print_usage(); } diff --git a/man/cpupcstat.8 b/man/cpupcstat.8 index 08a4a35..d84a726 100644 --- a/man/cpupcstat.8 +++ b/man/cpupcstat.8 @@ -40,6 +40,11 @@ This allows the user to specify the reporting interval. The default is 10 seconds. .TP +.B --target-global + +Gather statistics for all processes and the kernel running in the system. + +.TP .B --target-pid <pid> This allows the user to specify the pid of a process already that is already -- 1.7.1 ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel