Patch: Integrate async-profiler

Aleksey Shipilev shade at redhat.com
Mon Aug 3 17:54:56 UTC 2020


On 8/3/20 9:02 AM, Jason Zaugg wrote:
> This is my first patch contribution to an OpenJDK project, so I may need a little hand holding.
Thank you.

I have pushed two per-requisites cut out for your patch:
  http://hg.openjdk.java.net/code-tools/jmh/rev/263b2a063c7a
  http://hg.openjdk.java.net/code-tools/jmh/rev/a27f01a49609

This leaves the isolated change in AsyncProfiler.java. In turn, that needed a few improvements.
First of all, the indenting style is 4 spaces. I reformatted it in IDEA.

After that, I did a few hand polishings:
  *) Star imports turned to explicit imports;
  *) OptionSpecs reformatted in the same style: new lines between them, descriptions start with
capital letters, the fluent builder chain line-breaks at the same place. I understand the names are
used to build the raw option line, so those are not affected;
  *) The output directory is changed to the `pwd`, not createTempDir. We had trouble before with
overflowing the /tmp dirs on users machines. Plus, other profilers dump profiling results in `pwd`
as well.
  *) A bit of indenting in result printout, added "Async profiler results" header
  *) Replaced the hand-rolled write(File,String) method with a call to FileUtils
  *) Removed "//NONE" comment from OutputType
  *) Inlined JavaApi.ALL_THREADS;
  *) System now loads "asyncProfiler", not "libasyncProfiler". I believe it is a bug to pass the
OS-specific "lib" prefix there, and indeed current code does not work. It does work without "lib".

This is the resulting patch:
  https://cr.openjdk.java.net/~shade/jmh/async-profiler-fixes.patch

If you are fine with it, I can push the entire thing at once.

-- 
-Aleksey



More information about the jmh-dev mailing list