Package org.openjdk.jmh.profile
Class AbstractPerfAsmProfiler
- java.lang.Object
-
- org.openjdk.jmh.profile.AbstractPerfAsmProfiler
-
- All Implemented Interfaces:
ExternalProfiler
,Profiler
- Direct Known Subclasses:
DTraceAsmProfiler
,LinuxPerfAsmProfiler
,WinPerfAsmProfiler
public abstract class AbstractPerfAsmProfiler extends Object implements ExternalProfiler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractPerfAsmProfiler.PerfEvents
-
Field Summary
Fields Modifier and Type Field Description protected TempFile
hsLog
protected TempFile
perfBinData
protected TempFile
perfParsedData
protected List<String>
requestedEventNames
protected joptsimple.OptionSet
set
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPerfAsmProfiler(String initLine, String... events)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Collection<String>
addJVMOptions(BenchmarkParams params)
Add JVM these options to the run.protected abstract 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.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 params)
Run this code before starting the trial.protected abstract void
parseEvents()
Parse profiler events from binary to text form.protected abstract String
perfBinaryExtension()
Get perf binary data extension (optional).protected abstract AbstractPerfAsmProfiler.PerfEvents
readEvents(double skipMs, double lenMs)
Read parsed events.protected List<String>
stripEventNames(List<String> src)
Some profilers strip modifiers from event names.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openjdk.jmh.profile.ExternalProfiler
addJVMInvokeOptions
-
Methods inherited from interface org.openjdk.jmh.profile.Profiler
getDescription
-
-
-
-
Constructor Detail
-
AbstractPerfAsmProfiler
protected AbstractPerfAsmProfiler(String initLine, String... events) throws ProfilerException
- Throws:
ProfilerException
-
-
Method Detail
-
addMyOptions
protected abstract void addMyOptions(joptsimple.OptionParser parser)
-
addJVMOptions
public Collection<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 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
- 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
- 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
-
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
-
parseEvents
protected abstract void parseEvents()
Parse profiler events from binary to text form.
-
readEvents
protected abstract AbstractPerfAsmProfiler.PerfEvents readEvents(double skipMs, double lenMs)
Read parsed events.- Parameters:
skipMs
- Milliseconds to skip.lenMs
- Milliseconds to capture after skip- Returns:
- Events.
-
stripEventNames
protected List<String> stripEventNames(List<String> src)
Some profilers strip modifiers from event names. To properly match the events in shared code, we need to know what those events were stripped to.- Returns:
- stripped events
-
perfBinaryExtension
protected abstract String perfBinaryExtension()
Get perf binary data extension (optional).- Returns:
- Extension.
-
-