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
- 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 -
Method Summary
Modifier and TypeMethodDescriptionaddJVMInvokeOptions(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.Human-readable one-line description of the profiler.protected voidParse profiler events from binary to text form.protected StringGet 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 Details
-
DTraceAsmProfiler
- Throws:
ProfilerException
-
-
Method Details
-
beforeTrial
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
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
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
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
Description copied from class:AbstractPerfAsmProfilerGet perf binary data extension (optional).- Specified by:
perfBinaryExtensionin classAbstractPerfAsmProfiler- Returns:
- Extension.
-