Package org.openjdk.jmh.profile
Class DTraceAsmProfiler
java.lang.Object
org.openjdk.jmh.profile.AbstractPerfAsmProfiler
org.openjdk.jmh.profile.DTraceAsmProfiler
- All Implemented Interfaces:
ExternalProfiler
,Profiler
Mac OS X perfasm profiler based on DTrace "profile-n" provider which samples program counter by timer interrupt.
Due to DTrace limitations on Mac OS X target JVM cannot be run directly under DTrace control, so DTrace is run separately,
all processes are sampled and irrelevant samples are filtered out in
readEvents(double, double)
stage.
Super user privileges are required in order to run DTrace.
If you see a lot of "[unknown]" regions in profile then you are probably hitting kernel code, kernel sampling is not yet supported.
- Since:
- 18/10/2017
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openjdk.jmh.profile.AbstractPerfAsmProfiler
AbstractPerfAsmProfiler.ASMLine, AbstractPerfAsmProfiler.Assembly, AbstractPerfAsmProfiler.GeneratedRegion, AbstractPerfAsmProfiler.MethodDesc, AbstractPerfAsmProfiler.NativeRegion, AbstractPerfAsmProfiler.PerfEvents, AbstractPerfAsmProfiler.Region, AbstractPerfAsmProfiler.UnknownRegion
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Process
private joptsimple.OptionSpec
<Long> private String
private final long
Fields inherited from class org.openjdk.jmh.profile.AbstractPerfAsmProfiler
hsLog, perfBinData, perfParsedData, requestedEventNames, set
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddJVMInvokeOptions
(BenchmarkParams params) Prepend JVM invocation with these commands.protected void
addMyOptions
(joptsimple.OptionParser parser) Collection
<? extends Result> afterTrial
(BenchmarkResult br, long pid, File stdOut, File stdErr) Run this code after the trial is done.void
beforeTrial
(BenchmarkParams params) Run this code before starting the trial.Human-readable one-line description of the profiler.protected void
Parse profiler events from binary to text form.protected String
Get perf binary data extension (optional).protected AbstractPerfAsmProfiler.PerfEvents
readEvents
(double skipMs, double lenMs) Read parsed events.Methods inherited from class org.openjdk.jmh.profile.AbstractPerfAsmProfiler
addJVMOptions, allowPrintErr, allowPrintOut, stripEventNames
-
Field Details
-
sampleFrequency
private final long sampleFrequency -
pid
-
dtraceProcess
-
optFrequency
-
-
Constructor Details
-
DTraceAsmProfiler
- Throws:
ProfilerException
-
-
Method Details
-
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
- Overrides:
beforeTrial
in classAbstractPerfAsmProfiler
- Parameters:
params
- 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
- Overrides:
afterTrial
in classAbstractPerfAsmProfiler
- 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
-
addJVMInvokeOptions
Description copied from interface:ExternalProfiler
Prepend JVM invocation with these commands.- Parameters:
params
- benchmark parameters used for current launch- Returns:
- commands to prepend for JVM launch
-
getDescription
Description copied from interface:Profiler
Human-readable one-line description of the profiler.- Returns:
- description
-
addMyOptions
protected void addMyOptions(joptsimple.OptionParser parser) - Specified by:
addMyOptions
in classAbstractPerfAsmProfiler
-
parseEvents
protected void parseEvents()Description copied from class:AbstractPerfAsmProfiler
Parse profiler events from binary to text form.- Specified by:
parseEvents
in classAbstractPerfAsmProfiler
-
readEvents
Description copied from class:AbstractPerfAsmProfiler
Read parsed events.- Specified by:
readEvents
in classAbstractPerfAsmProfiler
- Parameters:
skipMs
- Milliseconds to skip.lenMs
- Milliseconds to capture after skip- Returns:
- Events.
-
perfBinaryExtension
Description copied from class:AbstractPerfAsmProfiler
Get perf binary data extension (optional).- Specified by:
perfBinaryExtension
in classAbstractPerfAsmProfiler
- Returns:
- Extension.
-