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 <m...@csn.ul.ie> --- cpupcstat | 34 +++++++++++++++++++++++++++------- 1 files changed, 27 insertions(+), 7 deletions(-) diff --git a/cpupcstat b/cpupcstat index 951ae05..eee4ed2 100755 --- a/cpupcstat +++ b/cpupcstat @@ -39,6 +39,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(); @@ -165,6 +176,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"); } @@ -271,6 +293,10 @@ if ($target) { chomp($target); } +if ($service) { + calc_tlbmiss_cost(); +} + $misses = 0; $kern_misses = 0; run_profile(); @@ -294,13 +320,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 ", -- 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