summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/lib/Benchmark.pm
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/perl5/lib/Benchmark.pm')
-rw-r--r--contrib/perl5/lib/Benchmark.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/perl5/lib/Benchmark.pm b/contrib/perl5/lib/Benchmark.pm
index a28f510..ef12d02 100644
--- a/contrib/perl5/lib/Benchmark.pm
+++ b/contrib/perl5/lib/Benchmark.pm
@@ -124,6 +124,11 @@ The COUNT can be zero or negative, see timethis().
Returns the difference between two Benchmark times as a Benchmark
object suitable for passing to timestr().
+=item timesum ( T1, T2 )
+
+Returns the sum of two Benchmark times as a Benchmark object suitable
+for passing to timestr().
+
=item timestr ( TIMEDIFF, [ STYLE, [ FORMAT ] ] )
Returns a string that formats the times in the TIMEDIFF object in
@@ -293,6 +298,15 @@ sub timediff {
bless \@r;
}
+sub timesum {
+ my($a, $b) = @_;
+ my @r;
+ for (my $i=0; $i < @$a; ++$i) {
+ push(@r, $a->[$i] + $b->[$i]);
+ }
+ bless \@r;
+}
+
sub timestr {
my($tr, $style, $f) = @_;
my @t = @$tr;
OpenPOWER on IntegriCloud