aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMel Gorman <mel@csn.ul.ie>2010-10-11 18:08:39 +0100
committerEric B Munson <emunson@mgebm.net>2010-10-11 14:50:23 -0700
commit53e062d46116e368fbd23e195ade8f354b75ca98 (patch)
tree1579d509dcf94dc9d9a6001ef9ae4338699cba98
parent03ef2a60189b22ddbe31efd6c1009d27b194979e (diff)
downloadlibhugetlbfs-53e062d46116e368fbd23e195ade8f354b75ca98.tar.gz
cpupcstat: Report time spent servicing TLB misses
While cpupcstat appeared to have most of the infrastructure necessary to work out the time spent servicing TLB misses, it does not make the actual calculation and print it. This patch should cover it. 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>
-rwxr-xr-xcpupcstat34
1 files changed, 27 insertions, 7 deletions
diff --git a/cpupcstat b/cpupcstat
index d222081..7f23d0a 100755
--- a/cpupcstat
+++ b/cpupcstat
@@ -38,6 +38,17 @@ my $miss_scale = 0;
my $ins_scale = 0;
my $cyc_scale = 0;
+sub calc_tlbmiss_cost()
+{
+ my $cost_script = `which tlbmiss_cost.sh`;
+ if ($cost_script eq "") {
+ $cost_script = "$Bin/contrib/tlbmiss_cost.sh";
+ }
+ my $data = `$cost_script --vmlinux $vmlinux`;
+ ($data,$cost_in_cycles) = split(/\=/, $data);
+ chomp($cost_in_cycles);
+}
+
sub start_target()
{
my $pid = fork();
@@ -161,6 +172,17 @@ sub run_profile()
($cyc_new * $cyc_scale) / ($new * $miss_scale));
}
$cyc_prev = $ret;
+ } elsif ($service) {
+
+ $ret = $collector->get_current_eventcount($binName,
+ "timer");
+ $cyc_new = $ret - $cyc_prev;
+ my $miss_cycles = $new * $cost_in_cycles * $miss_scale;
+ my $total_cycles = $cyc_new * $cyc_scale;
+
+ printf "%24.4f%%\n", $miss_cycles * 100/$total_cycles;
+
+ $cyc_prev = $ret;
} else {
print("\n");
}
@@ -265,6 +287,10 @@ if ($target) {
chomp($target);
}
+if ($service) {
+ calc_tlbmiss_cost();
+}
+
$misses = 0;
$kern_misses = 0;
run_profile();
@@ -288,13 +314,7 @@ if ($misses > 0) {
if ($service && $cycles > 0) {
if ($cost_in_cycles <= 0) {
- my $cost_script = `which tlbmiss_cost.sh`;
- if ($cost_script eq "") {
- $cost_script = "$Bin/contrib/tlbmiss_cost.sh";
- }
- my $data = `$cost_script --vmlinux $vmlinux`;
- ($data,$cost_in_cycles) = split(/\=/, $data);
- chomp($cost_in_cycles);
+ calc_tlbmiss_cost();
}
my $total_cost = $cost_in_cycles * $misses;
print("$target spent ",