ctubbsii commented on a change in pull request #155:
URL: https://github.com/apache/accumulo-testing/pull/155#discussion_r712524139



##########
File path: 
src/main/java/org/apache/accumulo/testing/performance/tests/ConditionalMutationsPT.java
##########
@@ -101,7 +101,7 @@ private static void runConditionalMutationsTest(Environment 
env, String tableNam
     }
 
     reportBuilder.result("avgRate: 1-19",
-        Double.parseDouble(new DecimalFormat("#0.00").format(rateSum / 20)),
+        Double.parseDouble(new DecimalFormat("#0.00").format(rateSum / 19)),

Review comment:
       It's weird that we run it 20 times, once before the loop of 19, but not 
collecting the sum for that first run. I'm not sure how to interpret the intent 
here without comments in the code. Without a better understanding of why we're 
doing that, it's not clear if the divisor should be changed or not.

##########
File path: 
src/main/java/org/apache/accumulo/testing/performance/tests/ConditionalMutationsPT.java
##########
@@ -150,7 +150,9 @@ public static double 
conditionalMutationsTime(ConditionalWriter cw, long seq) th
 
     long t2 = System.nanoTime();
 
-    return 10000.0 / TimeUnit.NANOSECONDS.toSeconds(t2 - t1);
+    double nanosPerSec = (double) TimeUnit.SECONDS.toNanos(1);
+    // return number of conditions per second
+    return 10000.0 / ((t2 - t1) / nanosPerSec);

Review comment:
       This would be more readable in a new method that can be reused more 
readably:
   
   ```java
   return rate(numEvents, startNanos, stopNanos);
   ```
   
   The method could look something like:
   
   ```java
   private static double rate(long numEvents, long startNanos, long stopNanos) {
     double nanosPerSec = 1.0E9; // or (double) TimeUnit.SECONDS.toNanos(1)
     double seconds = (t2 - t1) / nanosPerSec;
     return numEvents / seconds;
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to