MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / testRandomRead

Method testRandomRead

test/test/pmu/Dictionary.java:21–31  ·  view source on GitHub ↗
(long[] array, int bound)

Source from the content-addressed store, hash-verified

19public class Dictionary {
20
21 private static void testRandomRead(long[] array, int bound) {
22 long startTime = System.nanoTime();
23
24 for (long i = 0; i < Integer.MAX_VALUE; i++) {
25 int index = ThreadLocalRandom.current().nextInt(bound);
26 array[index]++;
27 }
28
29 long endTime = System.nanoTime();
30 System.out.printf("Time spent: %.3f\n", (endTime - startTime) / 1e9);
31 }
32
33 public static void test16K() {
34 long[] array = new long[8 * 1024 * 1024];

Callers 2

test16KMethod · 0.95
test8MMethod · 0.95

Calls 1

currentMethod · 0.80

Tested by

no test coverage detected