Patch: Integrate async-profiler
Mark Price
mark.web.mail at gmail.com
Thu Oct 1 13:25:52 UTC 2020
Hi folks,
thanks for the work on including async-profiler support.
I'm seeing some samples from warm-up iterations in the generated output,
but it looks as though the intent is to effectively trash the samples from
the warm-up phase:
if (!measurementStarted) {
// Discard samples collected during warmup and start
collecting again.
execute("start," + profilerConfig);
measurementStarted = true;
}
Verbose debugging shows that the profiler is started twice (as expected),
but I suspect the second 'start' command may be ignored:
# Preparing profilers: AsyncProfiler
# Warmup Iteration 1: [async-profiler] start,event=alloc,interval=1000000
13063.782 ops/s
# Warmup Iteration 2: 17541.943 ops/s
# Warmup Iteration 3: 18903.507 ops/s
Iteration 1: [async-profiler] start,event=alloc,interval=1000000
If I patch AsyncProfiler.java to output the response from the 'start'
command, I see:
# Preparing profilers: AsyncProfiler
# Warmup Iteration 1: [async-profiler] start,event=alloc,interval=1000000
*[async-profiler] Response: Started [alloc] profiling*
13730.857 ops/s
# Warmup Iteration 2: 18521.271 ops/s
# Warmup Iteration 3: 19195.448 ops/s
Iteration 1: [async-profiler] start,event=alloc,interval=1000000
*[async-profiler] Response: Profiler already started*
This change seems to solve the problem:
diff --git
a/jmh-core/src/main/java/org/openjdk/jmh/profile/AsyncProfiler.java
b/jmh-core/src/main/java/org/openjdk/jmh/profile/AsyncProfiler.java
index e9db5522..09ab53fc 100644
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/AsyncProfiler.java
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/AsyncProfiler.java
@@ -253,6 +253,9 @@ public final class AsyncProfiler implements
ExternalProfiler, InternalProfiler {
}
}
if (iterationParams.getType() == IterationType.MEASUREMENT) {
+ if (warmupStarted) {
+ execute("stop");
+ }
if (!measurementStarted) {
// Discard samples collected during warmup and start
collecting again.
execute("start," + profilerConfig);
Mark
On Wed, 5 Aug 2020 at 08:28, Aleksey Shipilev <shade at redhat.com> wrote:
> On 8/5/20 12:14 AM, Jason Zaugg wrote:
> > I'm not aware of anything further. It's working for me as a
> > replacement for the old integration.
> >
> > No doubt wider battle testing will throw up some issues; I'll keep an
> > eye on this list and address them.
> >
> > I gave the code a final review pass. Here's what I found that needs a
> > final tidy up.
>
> Ok, pushed.
>
> --
> -Aleksey
>
>
More information about the jmh-dev
mailing list