Package org.openjdk.jmh.profile
Class AsyncProfiler
java.lang.Object
org.openjdk.jmh.profile.AsyncProfiler
- All Implemented Interfaces:
ExternalProfiler
,InternalProfiler
,Profiler
A profiler based on async-profiler.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static enum
static final class
static enum
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AsyncProfiler.Direction
private final int
private final LinkedHashSet
<File> private final AsyncProfiler.JavaApi
private boolean
private int
private boolean
private final File
private final List
<AsyncProfiler.OutputType> private final String
private final String
private final int
private File
private final boolean
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddJVMInvokeOptions
(BenchmarkParams params) Prepend JVM invocation with these commands.addJVMOptions
(BenchmarkParams params) Add JVM these options to the run.Collection
<? extends Result> afterIteration
(BenchmarkParams benchmarkParams, IterationParams iterationParams, IterationResult iterationResult) Run this code after a benchmark iteration finishedCollection
<? extends Result> afterTrial
(BenchmarkResult br, long pid, File stdOut, File stdErr) Run this code after the trial is done.boolean
If target VM communicates with profiler with standard error, this method can be used to shun the output to console.boolean
If target VM communicates with profiler with standard output, this method can be used to shun the output to console.void
beforeIteration
(BenchmarkParams benchmarkParams, IterationParams iterationParams) Run this code before starting the next benchmark iteration.void
beforeTrial
(BenchmarkParams benchmarkParams) Run this code before starting the trial.private void
createTrialOutDir
(BenchmarkParams benchmarkParams) private void
private String
Human-readable one-line description of the profiler.private File
outputFile
(String fileNameFormat) private void
start()
private TextResult
-
Field Details
-
instance
-
verbose
private final boolean verbose -
direction
-
profilerConfig
-
output
-
outputFilePrefix
-
outDir
-
trialOutDir
-
traces
private final int traces -
flat
private final int flat -
isVersion1x
private boolean isVersion1x -
warmupStarted
private boolean warmupStarted -
measurementStarted
private boolean measurementStarted -
measurementIterationCount
private int measurementIterationCount -
generated
-
-
Constructor Details
-
AsyncProfiler
- Throws:
ProfilerException
-
-
Method Details
-
beforeIteration
Description copied from interface:InternalProfiler
Run this code before starting the next benchmark iteration.- Specified by:
beforeIteration
in interfaceInternalProfiler
- Parameters:
benchmarkParams
- benchmark parameters used for current launchiterationParams
- iteration parameters used for current launch
-
start
private void start() -
afterIteration
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams, IterationResult iterationResult) Description copied from interface:InternalProfiler
Run this code after a benchmark iteration finished- Specified by:
afterIteration
in interfaceInternalProfiler
- Parameters:
benchmarkParams
- benchmark parameters used for current launchiterationParams
- iteration parameters used for current launchiterationResult
- iteration result- Returns:
- profiler results
-
createTrialOutDir
-
stopAndDump
-
dump
-
outputFile
-
execute
-
addJVMInvokeOptions
Description copied from interface:ExternalProfiler
Prepend JVM invocation with these commands.- Specified by:
addJVMInvokeOptions
in interfaceExternalProfiler
- Parameters:
params
- benchmark parameters used for current launch- Returns:
- commands to prepend for JVM launch
-
addJVMOptions
Description copied from interface:ExternalProfiler
Add JVM these options to the run.- Specified by:
addJVMOptions
in interfaceExternalProfiler
- Parameters:
params
- benchmark parameters used for current launch- Returns:
- options to add to JVM launch
-
beforeTrial
Description copied from interface:ExternalProfiler
Run this code before starting the trial. This method will execute before starting the benchmark JVM.- Specified by:
beforeTrial
in interfaceExternalProfiler
- Parameters:
benchmarkParams
- benchmark parameters used for current launch
-
afterTrial
public Collection<? extends Result> afterTrial(BenchmarkResult br, long pid, File stdOut, File stdErr) Description copied from interface:ExternalProfiler
Run this code after the trial is done. This method will execute after benchmark JVM had stopped.- Specified by:
afterTrial
in interfaceExternalProfiler
- Parameters:
br
- benchmark result that was the result of the trialpid
- pid that the forked JVM hadstdOut
- file containing the standard output from the benchmark JVMstdErr
- file containing the standard error from the benchmark JVM- Returns:
- profiler results
-
allowPrintOut
public boolean allowPrintOut()Description copied from interface:ExternalProfiler
If target VM communicates with profiler with standard output, this method can be used to shun the output to console. Profiler is responsible for consuming the standard output and printing the relevant data from there.- Specified by:
allowPrintOut
in interfaceExternalProfiler
- Returns:
- returns true, if profiler allows harness to print out the standard output
-
allowPrintErr
public boolean allowPrintErr()Description copied from interface:ExternalProfiler
If target VM communicates with profiler with standard error, this method can be used to shun the output to console. Profiler is responsible for consuming the standard error and printing the relevant data from there.- Specified by:
allowPrintErr
in interfaceExternalProfiler
- Returns:
- returns true, if profiler allows harness to print out the standard errpr
-
getDescription
Description copied from interface:Profiler
Human-readable one-line description of the profiler.- Specified by:
getDescription
in interfaceProfiler
- Returns:
- description
-