-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSomeClassBench.java
More file actions
48 lines (43 loc) · 1.54 KB
/
SomeClassBench.java
File metadata and controls
48 lines (43 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package jmh.java;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OperationsPerInvocation;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
@Warmup(iterations = 3, time = 2)
@Measurement(iterations = 1, time = 30)
@Fork(1)
@OutputTimeUnit(TimeUnit.MINUTES)
@State(Scope.Benchmark)
public class SomeClassBench {
// The directory structure is important. The file should be in src/jmh/java
@Setup
public void setup() throws IOException {
// Read some file to setup the benchmark
// String filenamesCSV = System.getenv("SOME_FILENAMES");
// Read the file and set the fixture data
}
@Benchmark
@OperationsPerInvocation(20_000)
@BenchmarkMode(Mode.Throughput)
public void someBenchmarkTest() throws InterruptedException {
System.out.println("Benchmarking...");
Thread.sleep(1000);
// for (Map<String, Object> a : seedAttributed) {
// byte[] ret = testClass.somemethod(dest);
// bytes.sample(ret.length);
// bh.consume(ret);
// }
}
}