changeset 76:6a01a6075975

Tiny fix in ETA calculation.
author shade
date Mon, 03 Feb 2014 17:33:12 +0400
parents d84afc598b71
children 3f9cb5ab34d0
files jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ConsoleReportPrinter.java
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ConsoleReportPrinter.java	Mon Feb 03 16:34:46 2014 +0400
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ConsoleReportPrinter.java	Mon Feb 03 17:33:12 2014 +0400
@@ -242,7 +242,12 @@
 
     private String computeETA() {
         long timeSpent = System.nanoTime() - firstTest;
-        long nsToGo = (long)(timeSpent * (1.0 * totalExpectedResults / observedResults.get() - 1));
+        long resultsGot = observedResults.get() - 1; // first result is not timed
+        if (resultsGot == 0) {
+            return "n/a";
+        }
+
+        long nsToGo = (long)(timeSpent * (1.0 * (totalExpectedResults - 1) / resultsGot - 1));
         if (nsToGo > 0) {
             String result = "";
             long days = TimeUnit.NANOSECONDS.toDays(nsToGo);