aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMel Gorman <mel@csn.ul.ie>2010-10-11 18:08:33 +0100
committerEric B Munson <emunson@mgebm.net>2010-10-11 14:51:01 -0700
commit0cb2211ec932ffc6ac4f1272a13fd034bb528636 (patch)
tree4131169984d6543cb1166557b8c7ca27e3c0cb84
parent4436def68fc78facff5aa83ec82f2322450db92c (diff)
downloadlibhugetlbfs-0cb2211ec932ffc6ac4f1272a13fd034bb528636.tar.gz
tlbmiss_cost.sh: Allow monitoring of TLB miss events on a global basis
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 <mel@csn.ul.ie> Acked-by: Eric B Munson <emunson@mgebm.net> Signed-off-by: Eric B Munson <emunson@mgebm.net>
-rw-r--r--TLBC/OpCollect.pm7
-rw-r--r--TLBC/PerfCollect.pm2
-rwxr-xr-xcpupcstat8
-rw-r--r--man/cpupcstat.85
4 files changed, 18 insertions, 4 deletions
diff --git a/TLBC/OpCollect.pm b/TLBC/OpCollect.pm
index b5f0fcd..1dd0b3e 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 7f23d0a..e6b44c3 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;
@@ -115,6 +116,9 @@ sub run_profile()
$binName = $results[0];
}
$pid = start_target();
+ } elsif (defined $target_global) {
+ $binName='/';
+ $pid = $$;
}
$binName = `basename $binName`;
@@ -230,6 +234,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
@@ -262,6 +267,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,
@@ -274,7 +280,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