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
public class DTraceAsmProfiler extends AbstractPerfAsmProfiler
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 inreadEvents(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
Fields Modifier and Type Field Description private java.lang.Process
dtraceProcess
private joptsimple.OptionSpec<java.lang.Long>
optFrequency
private java.lang.String
pid
private long
sampleFrequency
-
Fields inherited from class org.openjdk.jmh.profile.AbstractPerfAsmProfiler
hsLog, perfBinData, perfParsedData, requestedEventNames, set
-
-
Constructor Summary
Constructors Constructor Description DTraceAsmProfiler(java.lang.String initLine)
-
Method Summary
All 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.protected void
addMyOptions(joptsimple.OptionParser parser)
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.void
beforeTrial(BenchmarkParams params)
Run this code before starting the trial.java.lang.String
getDescription()
Human-readable one-line description of the profiler.protected void
parseEvents()
Parse profiler events from binary to text form.protected java.lang.String
perfBinaryExtension()
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
-
-
-
-
Constructor Detail
-
DTraceAsmProfiler
public DTraceAsmProfiler(java.lang.String initLine) throws ProfilerException
- Throws:
ProfilerException
-
-
Method Detail
-
beforeTrial
public void beforeTrial(BenchmarkParams params)
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 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
- 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
public java.util.Collection<java.lang.String> addJVMInvokeOptions(BenchmarkParams params)
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
public java.lang.String 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
protected AbstractPerfAsmProfiler.PerfEvents readEvents(double skipMs, double lenMs)
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
protected java.lang.String perfBinaryExtension()
Description copied from class:AbstractPerfAsmProfiler
Get perf binary data extension (optional).- Specified by:
perfBinaryExtension
in classAbstractPerfAsmProfiler
- Returns:
- Extension.
-
-