aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric B Munson <ebmunson@us.ibm.com>2010-03-23 17:48:34 +0000
committerEric B Munson <ebmunson@us.ibm.com>2010-03-24 13:29:02 +0000
commit820146642a4f6ccd338e312dee0ed6c083325ac1 (patch)
tree50806daac9417ba132c96aef1c8183db29457696
parent729090a8fb993dd9dd347b9154dfc81d1603fde2 (diff)
downloadlibhugetlbfs-820146642a4f6ccd338e312dee0ed6c083325ac1.tar.gz
Add read_eventcount to collectors and cpupcstat
This patch seperates the data collection from the data processiong to allow better processing of multiple events. Signed-off-by: Eric B Munson <ebmunson@us.ibm.com>
-rw-r--r--TLBC/OpCollect.pm11
-rw-r--r--TLBC/PerfCollect.pm9
-rwxr-xr-xcpupcstat2
3 files changed, 16 insertions, 6 deletions
diff --git a/TLBC/OpCollect.pm b/TLBC/OpCollect.pm
index 7be19eb..b764848 100644
--- a/TLBC/OpCollect.pm
+++ b/TLBC/OpCollect.pm
@@ -19,6 +19,7 @@ use TLBC::DataCollect;
our @ISA = qw(TLBC::DataCollect);
my $reference;
+my $report;
my (%event_map, %lowlevel);
my (%event_col_map, %event_name);
@@ -103,7 +104,6 @@ sub samples()
sub _get_column()
{
my $self = shift;
- my $report = shift;
my $event = shift;
my @results;
my $line;
@@ -135,7 +135,6 @@ sub get_current_eventcount()
{
my @results;
my $line;
- my $report;
my $hits = 0;
my $self = shift;
my $binName = shift;
@@ -151,8 +150,6 @@ sub get_current_eventcount()
# The event column in opreport only uses the first 12 letters of
# the event name
$event = substr($event, 0, 12);
- system("opcontrol --dump > /dev/null 2>&1");
- $report = `opreport`;
@results = split(/\n/, $report);
$col = $self->_get_column($report, $event);
@@ -169,6 +166,12 @@ sub get_current_eventcount()
return $hits;
}
+sub read_eventcount()
+{
+ system("opcontrol --dump > /dev/null 2>&1");
+ $report = `opreport`;
+}
+
sub shutdown()
{
my $self = shift;
diff --git a/TLBC/PerfCollect.pm b/TLBC/PerfCollect.pm
index 91b1c48..e28fb2c 100644
--- a/TLBC/PerfCollect.pm
+++ b/TLBC/PerfCollect.pm
@@ -20,6 +20,7 @@ our @ISA = qw(TLBC::DataCollect);
my $perf_output = "/tmp/perf_" . $$ . ".data";
my $reference;
+my $report;
my $perf_pid;
my $perf_bin;
my $vmlinux;
@@ -95,8 +96,6 @@ sub get_current_eventcount()
{
my $self = shift;
my $binName = shift;
- my $cmd = $perf_bin . " report -k $vmlinux -i $perf_output";
- my $report = `$cmd`;
my $count = 0;
my $total;
my $line;
@@ -126,6 +125,12 @@ sub get_current_eventcount()
return $count;
}
+sub read_eventcount()
+{
+ my $cmd = $perf_bin . " report -k $vmlinux -i $perf_output";
+ $report = `$cmd`;
+}
+
sub shutdown()
{
my $self = shift;
diff --git a/cpupcstat b/cpupcstat
index 1f9b5ad..c928263 100755
--- a/cpupcstat
+++ b/cpupcstat
@@ -130,6 +130,7 @@ sub run_profile()
# runtime, collect oprofile data every $wait_time seconds to display
# the dtlb miss rate.
while (waitpid($pid, WNOHANG) <= 0 || $persist) {
+ $collector->read_eventcount();
$ret = $collector->get_current_eventcount($binName, "dtlb_miss");
$new = $ret - $prev;
printf("%15s%18d%19f", $binName, $new, $new / $wait_time);
@@ -168,6 +169,7 @@ sub run_profile()
}
$end_time = time();
$time_elapsed = $end_time - $start_time;
+ $collector->read_eventcount();
$misses = $collector->get_current_eventcount($binName, "dtlb_miss");
if ($instruct_ratio) {
$instructions = $collector->get_current_eventcount($binName, "instructions");