[svn:parrot] r42179 - trunk/tools/dev

japhb at svn.parrot.org japhb at svn.parrot.org
Sat Oct 31 07:05:58 UTC 2009


Author: japhb
Date: Sat Oct 31 07:05:55 2009
New Revision: 42179
URL: https://trac.parrot.org/parrot/changeset/42179

Log:
[tools] pprof2cg.pl: Third tuning pass

Modified:
   trunk/tools/dev/pprof2cg.pl

Modified: trunk/tools/dev/pprof2cg.pl
==============================================================================
--- trunk/tools/dev/pprof2cg.pl	Sat Oct 31 05:18:31 2009	(r42178)
+++ trunk/tools/dev/pprof2cg.pl	Sat Oct 31 07:05:55 2009	(r42179)
@@ -239,7 +239,7 @@
 
             $stats->{global_stats}{total_time} += $time;
             store_stats      ($stats, $cur_ctx,   $time, $extra);
-            store_stats_stack($stats, $ctx_stack, $time, $extra);
+            store_stats_stack($stats, $ctx_stack, $time);
         }
         else {
             die "Unrecognized line format: '$line'";
@@ -307,21 +307,17 @@
 
 =item C<store_stats_stack>
 
-This is a specialized version of C<core_stats> that walks up the context stack
+This is a specialized version of C<store_stats> that walks up the context stack
 adding time to each op in the stack, skipping tasks that can't occur for ops above
 the current op.
 
 =cut
 
 sub store_stats_stack {
-    my ($stats, $ctx_stack, $time, $extra) = @_;
+    my ($stats, $ctx_stack, $time) = @_;
 
-    for (1 .. $#$ctx_stack) {
-        my $loc   = $ctx_stack->[$_];
-        my $by_op = ($stats->{$loc->{file}}{$loc->{ns}}{$loc->{line}}[$loc->{op_num}] ||= {});
-
-        $by_op->{time} += $time;
-    }
+    $stats->{$_->{file}}{$_->{ns}}{$_->{line}}[$_->{op_num}]{time} += $time
+        for @$ctx_stack[1 .. $#$ctx_stack];
 }
 
 =item C<get_cg_profile>


More information about the parrot-commits mailing list