Revision: 1047
Author: [email protected]
Date: Mon Feb 8 06:49:42 2010
Log: In the merged profile, count the number of times each program was
profiled,
rather than listing its name that many times. This makes for a more readable
result when you're merging dozens of profiles.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1047
Modified:
/trunk/bin/nytprofmerge
=======================================
--- /trunk/bin/nytprofmerge Mon Feb 8 06:49:38 2010
+++ /trunk/bin/nytprofmerge Mon Feb 8 06:49:42 2010
@@ -321,8 +321,16 @@
my $value = min(@values);
$out->write(":$key=$value\n");
} elsif ($key eq 'application') {
- my $last = pop @values;
- my $value = @values ? join (', ', @values) . "and $last" : $last;
+ my %counts;
+ $counts{$_}++ foreach @values;
+ my @grouped;
+ foreach my $prog (sort keys %counts) {
+ my $count = $counts{$prog};
+ push @grouped,
+ sprintf "$prog ($count run%s)", $count == 1 ? '' : 's';
+ }
+ my $last = pop @grouped;
+ my $value = @grouped ? join (', ', @grouped) . "and $last" : $last;
$out->write(":$key=$value\n");
} else {
warn "Unknown attribute $key\n";
--
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]