summaryrefslogtreecommitdiff
path: root/lib/Benchmark.pm
diff options
context:
space:
mode:
authorThomas Bowditch <bowditch@inmet.com>1998-11-20 12:43:46 -0500
committerJarkko Hietaniemi <jhi@iki.fi>1998-11-21 10:44:01 +0000
commit705cc2552a6910dd0106708eca1060809507816d (patch)
treefb95c23e690a75ba88cb331060c064ce48d3f0b0 /lib/Benchmark.pm
parent9d7f10f2fcf4722ba2d0742a5b1dac717e493166 (diff)
downloadperl-705cc2552a6910dd0106708eca1060809507816d.tar.gz
Benchmark.pm suggestion
To: jhi@iki.fi, Tim.Bunce@ig.co.uk Message-Id: <199811202243.RAA26252@harp.camb.inmet.com> Added timesum(). p4raw-id: //depot/cfgperl@2256
Diffstat (limited to 'lib/Benchmark.pm')
-rw-r--r--lib/Benchmark.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Benchmark.pm b/lib/Benchmark.pm
index a28f510d11..ef12d02fcb 100644
--- a/lib/Benchmark.pm
+++ b/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;