diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java index fc1a2a7fce..70f17facec 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -1,6 +1,7 @@ package javababushka.benchmarks.utils; import java.io.FileWriter; +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -221,6 +222,7 @@ public static void testClientSetGet( "===> concurrentNum = %d, clientNum = %d, tasks = %d%n", concurrentNum, clientCount, tasks.size()); } + long before = System.nanoTime(); tasks.stream() .map(CompletableFuture::runAsync) .forEach( @@ -231,8 +233,22 @@ public static void testClientSetGet( e.printStackTrace(); } }); + long after = System.nanoTime(); + // print results per action printResults(calculateResults(actionResults), config.resultsFile); + + // print TPS + if (config.resultsFile.isPresent()) { + try { + config.resultsFile.get().append( + "Avg. time in ms: " + (after - before) / iterations / LATENCY_NORMALIZATION); + } catch (IOException ignored) { + } + } else { + System.out.println( + "Avg. time in ms: " + (after - before) / iterations / LATENCY_NORMALIZATION); + } } } }