From 8a76a6639317f6f3a6a11d0daab3060793d83df7 Mon Sep 17 00:00:00 2001
From: kglynn <unknown>
Date: Tue, 9 Nov 1999 00:14:50 +0000
Subject: [PATCH] [project @ 1999-11-09 00:14:50 by kglynn] Support for
 negative timings in the stats file.  (I've seen times of -0.00). If a timing
 is negative then set it to 0.

---
 glafp-utils/runstdtest/runstdtest.prl | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/glafp-utils/runstdtest/runstdtest.prl b/glafp-utils/runstdtest/runstdtest.prl
index 906f503bfc37..3c4c7c21b108 100644
--- a/glafp-utils/runstdtest/runstdtest.prl
+++ b/glafp-utils/runstdtest/runstdtest.prl
@@ -400,11 +400,11 @@ sub process_stats_file {
 		$TotMem = $1;
 	    }
 
-	    if ( /^\s*INIT\s+time\s*(\d+\.\d\d)s\s*\(\s*(\d+\.\d\d)s elapsed\)/ ) {
+	    if ( /^\s*INIT\s+time\s*(-*\d+\.\d\d)s\s*\(\s*(-*\d+\.\d\d)s elapsed\)/ ) {
 		$InitTime = $1; $InitElapsed = $2;
-	    } elsif ( /^\s*MUT\s+time\s*(\d+\.\d\d)s\s*\(\s*(\d+\.\d\d)s elapsed\)/ ) {
+	    } elsif ( /^\s*MUT\s+time\s*(-*\d+\.\d\d)s\s*\(\s*(-*\d+\.\d\d)s elapsed\)/ ) {
 		$MutTime = $1; $MutElapsed = $2;
-	    } elsif ( /^\s*GC\s+time\s*(\d+\.\d\d)s\s*\(\s*(\d+\.\d\d)s elapsed\)/ ) {
+	    } elsif ( /^\s*GC\s+time\s*(-*\d+\.\d\d)s\s*\(\s*(-*\d+\.\d\d)s elapsed\)/ ) {
 		$GcTime = $1; $GcElapsed = $2;
 	    }
 	}
@@ -467,6 +467,15 @@ sub process_stats_file {
     $MutElapsed =~ s/,//g;
     $GcTime =~ s/,//g;
     $GcElapsed =~ s/,//g;
+
+    # if timings are negative (I've seen -0.00s) then set to 0
+    $InitTime           = 0 unless $InitTime >= 0;
+    $InitElapsed        = 0 unless $InitElapsed >= 0; 
+    $MutTime            = 0 unless $MutTime >= 0;
+    $MutElapsed         = 0 unless $MutElapsed >= 0;
+    $GcTime             = 0 unless $GcTime >= 0;
+    $GcElapsed          = 0 unless $GcElapsed >= 0;
+    
 }
 
 sub process_spixstats_files { # 2 of them; one for mutator, one for GC
-- 
GitLab