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
- Author:
- Tolstopyatov Vsevolod
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openjdk.jmh.profile.AbstractPerfAsmProfiler
AbstractPerfAsmProfiler.PerfEvents
-
-
Field Summary
-
Fields inherited from class org.openjdk.jmh.profile.AbstractPerfAsmProfiler
hsLog, perfBinData, perfParsedData, requestedEventNames, set
-
-
Constructor Summary
Constructors Constructor Description DTraceAsmProfiler(String initLine)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<String>addJVMInvokeOptions(BenchmarkParams params)Prepend JVM invocation with these commands.protected voidaddMyOptions(joptsimple.OptionParser parser)Collection<? extends Result>afterTrial(BenchmarkResult br, long pid, File stdOut, File stdErr)Run this code after the trial is done.voidbeforeTrial(BenchmarkParams params)Run this code before starting the trial.StringgetDescription()Human-readable one-line description of the profiler.protected voidparseEvents()Parse profiler events from binary to text form.protected StringperfBinaryExtension()Get perf binary data extension (optional).protected AbstractPerfAsmProfiler.PerfEventsreadEvents(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(String initLine) throws ProfilerException
- Throws:
ProfilerException
-
-
Method Detail
-
beforeTrial
public void beforeTrial(BenchmarkParams params)
Description copied from interface:ExternalProfilerRun this code before starting the trial. This method will execute before starting the benchmark JVM.- Specified by:
beforeTrialin interfaceExternalProfiler- Overrides:
beforeTrialin 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:ExternalProfilerRun this code after the trial is done. This method will execute after benchmark JVM had stopped.- Specified by:
afterTrialin interfaceExternalProfiler- Overrides:
afterTrialin 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 Collection<String> addJVMInvokeOptions(BenchmarkParams params)
Description copied from interface:ExternalProfilerPrepend JVM invocation with these commands.- Parameters:
params- benchmark parameters used for current launch- Returns:
- commands to prepend for JVM launch
-
getDescription
public String getDescription()
Description copied from interface:ProfilerHuman-readable one-line description of the profiler.- Returns:
- description
-
addMyOptions
protected void addMyOptions(joptsimple.OptionParser parser)
- Specified by:
addMyOptionsin classAbstractPerfAsmProfiler
-
parseEvents
protected void parseEvents()
Description copied from class:AbstractPerfAsmProfilerParse profiler events from binary to text form.- Specified by:
parseEventsin classAbstractPerfAsmProfiler
-
readEvents
protected AbstractPerfAsmProfiler.PerfEvents readEvents(double skipMs, double lenMs)
Description copied from class:AbstractPerfAsmProfilerRead parsed events.- Specified by:
readEventsin classAbstractPerfAsmProfiler- Parameters:
skipMs- Milliseconds to skip.lenMs- Milliseconds to capture after skip- Returns:
- Events.
-
perfBinaryExtension
protected String perfBinaryExtension()
Description copied from class:AbstractPerfAsmProfilerGet perf binary data extension (optional).- Specified by:
perfBinaryExtensionin classAbstractPerfAsmProfiler- Returns:
- Extension.
-
-