perfasm as a stand-alone tool

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Nov 17 20:36:15 UTC 2014


On 17.11.2014 22:54, Deneau, Tom wrote:
> The perfasm profiler is really useful is really useful.  I was
> wondering whether anyone has built on the same techniques of merging
> PrintAssembly, LogCompilation and Perf Record data for a tool that
> would work outside the JMH framework?

Perfasm profiler is maturing in its host, JMH. I think it hits the sweet
spot of its usefulness -- that is, looking into nano- and
micro-benchmarks. In fact, I don't even consider perfasm a profiler, but
more of an intelligent filter over PrintAssembly that contrasts the
parts of assembly you need to digest :)

The returns are quickly diminishing when you are trying to analyze
something with more than a handful of very visible bottlenecks. Because
of that, the sweetest spot for perfasm is steady-state benchmarks. Once
you have a changing environment, the clutter builds up in timeline-less
profile view.

Not to mention the PrintAssembly interface is limiting when you have
code cache flushes, and addresses start to be reused -- we print a
warning now, but this is not an expected behavior of production-grade
profiler. Tighter integration with JVMTI/perf is required to properly
handle this case.

Therefore, I have doubts we need to redo the functionality/usability
things already done in other application-scale profilers. For example,
Solaris Studio Performance Analyzer [1] is already quite capable of
doing the same thing in much more structured way: hardware counter
profiling is there, Java/native support is there as well. It can be
invoked with a simple CLI interface for any existing C/C++/Java program
-- in fact this is how we profile Hotspot+JDK these days, including the
cases when perfasm is not enough:

 $ alias perfanal
alias perfanal='~/Install/solstudio/bin/collect -o test.1.er -S on -j on
-A on '
 $ perfanal java Hello


I think Brendan Gregg [2] and others are experimenting with perf and
Java. IIRC, the community around flame graphs tried using JVMTI agents
[3] to get the compiled code, and then disassemble/map it onto perf
events, and visualize it with flame graphs.

Twitter folks were showing some support for Linux perf and Hotspot [4],
and they were intent to open-source it, but AFAIR it did not happen yet.

I am sure something else is lurking there in stealth mode.

Thanks,
-Aleksey.

[1]
http://www.oracle.com/technetwork/server-storage/solarisstudio/features/performance-analyzer-2292312.html
[2] http://www.brendangregg.com/blog/2014-06-12/java-flame-graphs.html
[3] https://github.com/jrudolph/perf-map-agent
[4]
https://speakerdeck.com/kaushik/tracing-and-profiling-java-and-native-applications-in-production



More information about the jmh-dev mailing list