Revision: 1417
Author:   [email protected]
Date:     Thu Mar 22 09:00:59 2012
Log:      sum cumulative_overhead_ticks in nytprofmerge RT#75909
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1417

Modified:
 /trunk/Changes
 /trunk/bin/nytprofmerge
 /trunk/t/lib/NYTProfTest.pm

=======================================
--- /trunk/Changes      Thu Mar 22 08:46:17 2012
+++ /trunk/Changes      Thu Mar 22 09:00:59 2012
@@ -14,6 +14,7 @@
   Added warning for Apache2::SizeLimit in ::Apache, RT#75912.
   Updated ::Apache docs including troubleshooting, RT#75912.
   nytprofmerge no longer dies on some errors, RT#75918.
+  nytprofmerge now sums cumulative_overhead_ticks, RT#75909.

 =head2 Changes in Devel::NYTProf 4.06 (svn r1406) 30th Nov 2010

=======================================
--- /trunk/bin/nytprofmerge     Thu Mar 22 08:48:06 2012
+++ /trunk/bin/nytprofmerge     Thu Mar 22 09:00:59 2012
@@ -16,7 +16,7 @@
 use Devel::NYTProf::Core;
 require Devel::NYTProf::FileHandle;
 require Devel::NYTProf::Data;
-use List::Util qw(min);
+use List::Util qw(min sum);

 our $VERSION = '4.06';

@@ -313,10 +313,12 @@

 foreach my $key (sort grep {!$identical{$_}} keys %attributes) {
     my @values = @{$attributes{$key}};
+
     if ($key eq 'basetime') {
         my $value = min(@values);
         $out->write_attribute($key, $value);
-    } elsif ($key eq 'application') {
+    }
+    elsif ($key eq 'application') { # "merge" the application names
         my %counts;
         $counts{$_}++ foreach @values;
         my @grouped;
@@ -328,8 +330,13 @@
         my $last = pop @grouped;
my $value = @grouped ? join (', ', @grouped) . " and $last" : $last;
         $out->write_attribute($key, $value);
-    } else {
-        warn "Unknown attribute $key\n";
+    }
+ elsif ($key eq 'cumulative_overhead_ticks') { # sum cumulative_overhead_ticks
+        $out->write_attribute($key, sum(@values));
+    }
+    else {
+ warn sprintf "Unknown attribute %s has %d values passed through unmerged\n",
+            $key, scalar @values;
         $out->write_attribute($key, $_) foreach @values;
     }
 }
=======================================
--- /trunk/t/lib/NYTProfTest.pm Sun Sep 19 04:04:28 2010
+++ /trunk/t/lib/NYTProfTest.pm Thu Mar 22 09:00:59 2012
@@ -318,6 +318,7 @@
         if ($opts{mergerdt}) { # run the file through nytprofmerge
             my $merged = "$profile_datafile.merged";
my $merge_cmd = "$nytprofmerge -v --out=$merged $test_datafile";
+            warn "$merge_cmd\n";
             system($merge_cmd) == 0
                 or die "Error running $merge_cmd\n";
             verify_data($test, "$tag (merged)", $merged);

--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]

Reply via email to