Package org.openjdk.jmh.runner
Class BenchmarkHandler
java.lang.Object
org.openjdk.jmh.runner.BenchmarkHandler
Base class for all benchmarks handlers.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
Worker body.private static enum
private static class
Handles thread-local data for each worker that should not change between the iterations. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Class
<?> private final ExecutorService
Thread-pool for threads executing the benchmark tasksprivate static final BenchmarkHandler.ExecutorType
private final Method
private final OutputFormat
private final List
<InternalProfiler> private final List
<InternalProfiler> private final BlockingQueue
<ThreadParams> private final ConcurrentMap
<Thread, BenchmarkHandler.WorkerData> -
Constructor Summary
ConstructorsConstructorDescriptionBenchmarkHandler
(OutputFormat out, Options options, BenchmarkParams executionParams) -
Method Summary
Modifier and TypeMethodDescription(package private) static List
<ThreadParams> distributeThreads
(int threads, int[] groups) static Method
findBenchmarkMethod
(Class<?> clazz, String methodName) private static boolean
checks if method signature is valid benchmark signature, besited checks if method signature corresponds to benchmark type.private BenchmarkHandler.WorkerData
newWorkerData
(Thread worker) runIteration
(BenchmarkParams benchmarkParams, IterationParams params, boolean last) Runs an iteration on the handled benchmark.void
shutdown()
Do required shutdown actions.protected void
startProfilers
(BenchmarkParams benchmarkParams, IterationParams iterationParams) protected void
stopProfilers
(BenchmarkParams benchmarkParams, IterationParams iterationParams, IterationResult iterationResults)
-
Field Details
-
executor
Thread-pool for threads executing the benchmark tasks -
workerData
-
tps
-
out
-
profilers
-
profilersRev
-
clazz
-
method
-
EXECUTOR_TYPE
-
-
Constructor Details
-
BenchmarkHandler
-
-
Method Details
-
distributeThreads
-
findBenchmarkMethod
-
isValidBenchmarkSignature
checks if method signature is valid benchmark signature, besited checks if method signature corresponds to benchmark type.- Parameters:
m
-- Returns:
-
startProfilers
-
stopProfilers
protected void stopProfilers(BenchmarkParams benchmarkParams, IterationParams iterationParams, IterationResult iterationResults) -
shutdown
public void shutdown()Do required shutdown actions. -
runIteration
public IterationResult runIteration(BenchmarkParams benchmarkParams, IterationParams params, boolean last) Runs an iteration on the handled benchmark.- Parameters:
benchmarkParams
- Benchmark parametersparams
- Iteration parameterslast
- Should this iteration considered to be the last- Returns:
- IterationResult
-
newWorkerData
-