Skip to content

Commit 9b45b60

Browse files
committed
fix: correct calculations in BenchmarkRunner
1 parent df4f06a commit 9b45b60

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

org.eclipse.tm4e.core/src/test/java/org/eclipse/tm4e/core/benchmark/BenchmarkRunner.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ public static void run(final int warmUpRounds, final int benchmarkRounds, final
2222
Locale.setDefault(Locale.ENGLISH);
2323
System.out.println("JVM Vendor: " + System.getProperty("java.vendor"));
2424
System.out.println("JVM Version: " + System.getProperty("java.version"));
25-
System.out.println(String.format("JVM Inital Heap: %.2f MB", RUNTIME.maxMemory() / (float) 1024 / 1024));
26-
System.out.println(String.format("JVM Maximum Heap: %.2f MB", RUNTIME.totalMemory() / (float) 1024 / 1024));
25+
System.out.println(String.format("JVM Initial Heap: %.2f MB", RUNTIME.totalMemory() / (float) 1024 / 1024));
26+
System.out.println(String.format("JVM Maximum Heap: %.2f MB", RUNTIME.maxMemory() / (float) 1024 / 1024));
2727
System.out.println("JVM Args: " + String.join(" ", ManagementFactory.getRuntimeMXBean().getInputArguments()));
2828
System.out.println(SEPARATOR);
2929

3030
System.out.println("Warmup Rounds: " + warmUpRounds);
31-
System.out.println("Benchmark Rounds: " + warmUpRounds);
31+
System.out.println("Benchmark Rounds: " + benchmarkRounds);
3232
System.out.println("Operations per Benchmark Round: " + opsPerBenchmarkRound);
3333
System.out.println(SEPARATOR);
3434

@@ -61,7 +61,7 @@ private static void runRound(final String label, final int round, final int tota
6161
System.gc();
6262
Thread.sleep(1_000);
6363
} catch (final InterruptedException ex) {
64-
Thread.interrupted();
64+
Thread.currentThread().interrupt();
6565
throw new RuntimeException(ex);
6666
}
6767
}
@@ -75,7 +75,7 @@ private static void runRound(final String label, final int round, final int tota
7575

7676
final var durationMS = System.currentTimeMillis() - startAt;
7777
final var durationMSPerIteration = durationMS / (float) iterations;
78-
final var iterationsPerSecond = 60_000 / durationMSPerIteration;
78+
final var iterationsPerSecond = (iterations / (float) durationMS) * 1_000;
7979

8080
if (measureHeapUsage) {
8181
final var heapBytesPerIteration = (startFreeMem - RUNTIME.freeMemory()) / (float) iterations;

0 commit comments

Comments
 (0)