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 java.lang.Object implements ExternalProfiler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
AbstractPerfAsmProfiler.ASMLine
(package private) static class
AbstractPerfAsmProfiler.Assembly
(package private) static class
AbstractPerfAsmProfiler.GeneratedRegion
(package private) static class
AbstractPerfAsmProfiler.MethodDesc
(package private) static class
AbstractPerfAsmProfiler.NativeRegion
protected static class
AbstractPerfAsmProfiler.PerfEvents
(package private) static class
AbstractPerfAsmProfiler.Region
(package private) static class
AbstractPerfAsmProfiler.UnknownRegion
-
Field Summary
Fields Modifier and Type Field Description private int
delayMsec
private boolean
drawInterJumps
private boolean
drawIntraJumps
protected TempFile
hsLog
private boolean
intelSyntax
private int
lengthMsec
private int
mergeMargin
private boolean
mergeMethods
protected TempFile
perfBinData
protected TempFile
perfParsedData
private boolean
printCompilationInfo
private int
printMargin
private double
regionRateThreshold
private int
regionShowTop
private int
regionTooBigThreshold
protected java.util.List<java.lang.String>
requestedEventNames
private boolean
saveLog
private java.lang.String
saveLogTo
private java.lang.String
saveLogToFile
private boolean
savePerfBin
private java.lang.String
savePerfBinFile
private java.lang.String
savePerfBinTo
private boolean
savePerfOutput
private java.lang.String
savePerfOutputTo
private java.lang.String
savePerfOutputToFile
protected joptsimple.OptionSet
set
private boolean
skipAssembly
private boolean
skipInterpreter
private boolean
skipVMStubs
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPerfAsmProfiler(java.lang.String initLine, java.lang.String... events)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private void
addInterval(java.util.List<Interval> intervals, long begAddr, long lastAddr, AbstractPerfAsmProfiler.Assembly asms)
java.util.Collection<java.lang.String>
addJVMOptions(BenchmarkParams params)
Add JVM these options to the run.protected abstract 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.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.private java.util.List<Interval>
figureHotIntervals(java.util.SortedSet<java.lang.Long> addrs, AbstractPerfAsmProfiler.Assembly asms)
private java.util.List<AbstractPerfAsmProfiler.Region>
makeRegions(AbstractPerfAsmProfiler.Assembly asms, AbstractPerfAsmProfiler.PerfEvents events)
private boolean
maybeAddress(java.lang.String str)
private long
parseAddress(java.lang.String address)
protected abstract void
parseEvents()
Parse profiler events from binary to text form.protected abstract java.lang.String
perfBinaryExtension()
Get perf binary data extension (optional).private void
printDottedLine(java.io.PrintWriter pw)
private void
printDottedLine(java.io.PrintWriter pw, java.lang.String header)
private static void
printLine(java.io.PrintWriter pw, AbstractPerfAsmProfiler.PerfEvents events, java.lang.String event, long count)
private TextResult
processAssembly(BenchmarkResult br)
private AbstractPerfAsmProfiler.Assembly
readAssembly(java.io.File stdOut)
protected abstract AbstractPerfAsmProfiler.PerfEvents
readEvents(double skipMs, double lenMs)
Read parsed events.private java.util.Collection<java.util.Collection<java.lang.String>>
splitAssembly(java.io.File stdOut)
protected java.util.List<java.lang.String>
stripEventNames(java.util.List<java.lang.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
-
-
-
-
Field Detail
-
requestedEventNames
protected final java.util.List<java.lang.String> requestedEventNames
-
regionRateThreshold
private final double regionRateThreshold
-
regionShowTop
private final int regionShowTop
-
regionTooBigThreshold
private final int regionTooBigThreshold
-
printMargin
private final int printMargin
-
mergeMargin
private final int mergeMargin
-
mergeMethods
private final boolean mergeMethods
-
delayMsec
private final int delayMsec
-
lengthMsec
private final int lengthMsec
-
skipAssembly
private final boolean skipAssembly
-
skipInterpreter
private final boolean skipInterpreter
-
skipVMStubs
private final boolean skipVMStubs
-
savePerfOutput
private final boolean savePerfOutput
-
savePerfOutputTo
private final java.lang.String savePerfOutputTo
-
savePerfOutputToFile
private final java.lang.String savePerfOutputToFile
-
savePerfBin
private final boolean savePerfBin
-
savePerfBinTo
private final java.lang.String savePerfBinTo
-
savePerfBinFile
private final java.lang.String savePerfBinFile
-
saveLog
private final boolean saveLog
-
saveLogTo
private final java.lang.String saveLogTo
-
saveLogToFile
private final java.lang.String saveLogToFile
-
printCompilationInfo
private final boolean printCompilationInfo
-
intelSyntax
private final boolean intelSyntax
-
hsLog
protected final TempFile hsLog
-
perfBinData
protected final TempFile perfBinData
-
perfParsedData
protected final TempFile perfParsedData
-
set
protected final joptsimple.OptionSet set
-
drawIntraJumps
private final boolean drawIntraJumps
-
drawInterJumps
private final boolean drawInterJumps
-
-
Constructor Detail
-
AbstractPerfAsmProfiler
protected AbstractPerfAsmProfiler(java.lang.String initLine, java.lang.String... events) throws ProfilerException
- Throws:
ProfilerException
-
-
Method Detail
-
addMyOptions
protected abstract void addMyOptions(joptsimple.OptionParser parser)
-
addJVMOptions
public java.util.Collection<java.lang.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 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
- 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 java.util.List<java.lang.String> stripEventNames(java.util.List<java.lang.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 java.lang.String perfBinaryExtension()
Get perf binary data extension (optional).- Returns:
- Extension.
-
processAssembly
private TextResult processAssembly(BenchmarkResult br)
-
printLine
private static void printLine(java.io.PrintWriter pw, AbstractPerfAsmProfiler.PerfEvents events, java.lang.String event, long count)
-
printDottedLine
private void printDottedLine(java.io.PrintWriter pw)
-
printDottedLine
private void printDottedLine(java.io.PrintWriter pw, java.lang.String header)
-
makeRegions
private java.util.List<AbstractPerfAsmProfiler.Region> makeRegions(AbstractPerfAsmProfiler.Assembly asms, AbstractPerfAsmProfiler.PerfEvents events)
-
figureHotIntervals
private java.util.List<Interval> figureHotIntervals(java.util.SortedSet<java.lang.Long> addrs, AbstractPerfAsmProfiler.Assembly asms)
-
addInterval
private void addInterval(java.util.List<Interval> intervals, long begAddr, long lastAddr, AbstractPerfAsmProfiler.Assembly asms)
-
splitAssembly
private java.util.Collection<java.util.Collection<java.lang.String>> splitAssembly(java.io.File stdOut)
-
readAssembly
private AbstractPerfAsmProfiler.Assembly readAssembly(java.io.File stdOut)
-
maybeAddress
private boolean maybeAddress(java.lang.String str)
-
parseAddress
private long parseAddress(java.lang.String address)
-
-