Package org.openjdk.jmh.profile
Class SafepointsProfiler
- java.lang.Object
-
- org.openjdk.jmh.profile.SafepointsProfiler
-
- All Implemented Interfaces:
ExternalProfiler
,Profiler
public class SafepointsProfiler extends java.lang.Object implements ExternalProfiler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
SafepointsProfiler.ParsedData
(package private) static class
SafepointsProfiler.SafepointProfilerResult
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.Pattern
JDK_7_LINE
private static java.util.regex.Pattern
JDK_8_LINE
private static java.util.regex.Pattern
JDK_9_LINE
private static long
NO_LONG_VALUE
-
Constructor Summary
Constructors Constructor Description SafepointsProfiler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<java.lang.String>
addJVMInvokeOptions(BenchmarkParams params)
Prepend JVM invocation with these commands.java.util.Collection<java.lang.String>
addJVMOptions(BenchmarkParams params)
Add JVM these options to the run.java.util.Collection<? extends Result>
afterTrial(BenchmarkResult br, long pid, java.io.File stdOut, java.io.File stdErr)
Run this code after the trial is done.boolean
allowPrintErr()
If target VM communicates with profiler with standard error, this method can be used to shun the output to console.boolean
allowPrintOut()
If target VM communicates with profiler with standard output, this method can be used to shun the output to console.void
beforeTrial(BenchmarkParams benchmarkParams)
Run this code before starting the trial.java.lang.String
getDescription()
Human-readable one-line description of the profiler.(package private) static SafepointsProfiler.ParsedData
parse(java.lang.String line)
Parse the line into the triplet.(package private) static long
parseNs(java.lang.String str)
-
-
-
Field Detail
-
NO_LONG_VALUE
private static final long NO_LONG_VALUE
- See Also:
- Constant Field Values
-
JDK_7_LINE
private static final java.util.regex.Pattern JDK_7_LINE
-
JDK_8_LINE
private static final java.util.regex.Pattern JDK_8_LINE
-
JDK_9_LINE
private static final java.util.regex.Pattern JDK_9_LINE
-
-
Method Detail
-
getDescription
public java.lang.String getDescription()
Description copied from interface:Profiler
Human-readable one-line description of the profiler.- Specified by:
getDescription
in interfaceProfiler
- Returns:
- description
-
addJVMInvokeOptions
public java.util.Collection<java.lang.String> addJVMInvokeOptions(BenchmarkParams params)
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
public java.util.Collection<java.lang.String> addJVMOptions(BenchmarkParams params)
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
public void beforeTrial(BenchmarkParams benchmarkParams)
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 java.util.Collection<? extends Result> afterTrial(BenchmarkResult br, long pid, java.io.File stdOut, java.io.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
-
parseNs
static long parseNs(java.lang.String str)
-
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
-
parse
static SafepointsProfiler.ParsedData parse(java.lang.String line)
Parse the line into the triplet. This is tested with unit tests, make sure to update those if changing this code.
-
-