MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / timeTest

Method timeTest

concurrent/Summing.java:10–20  ·  view source on GitHub ↗
(String id, long checkValue,
    LongSupplier operation)

Source from the content-addressed store, hash-verified

8
9public class Summing {
10 static void timeTest(String id, long checkValue,
11 LongSupplier operation) {
12 System.out.print(id + ": ");
13 Timer timer = new Timer();
14 long result = operation.getAsLong();
15 if(result == checkValue)
16 System.out.println(timer.duration() + "ms");
17 else
18 System.out.format("result: %d%ncheckValue: %d%n",
19 result, checkValue);
20 }
21 public static final int SZ = 100_000_000;
22 // This even works:
23 // public static final int SZ = 1_000_000_000;

Callers 4

mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95

Calls 4

durationMethod · 0.95
printMethod · 0.80
getAsLongMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected