I have very long running tests in my maven build. These tests are integration tests run with failsafe plugin (mvn verify
).
I try to profile these tests using JProfiler.
The tests runs correctly but I don't see anything useful in JProfiler as if JProfiler was filtering them out.
I'm on openSUSE 13.1 x64, with Maven 3.2.1 and JProfiler 8.0.5
The JProfiler session settings are the default ones with two modifications :
- Start CPU profiling automatically at start
- Keep the VM alive when the execution is finished (to enable backtracing info)
I launch the profiled build using this command :
MAVEN_OPTS="-agentpath:/opt/jprofiler8/bin/linux-x64/libjprofilerti.so=port=8849" mvn verify
Maven and JProfiler run on the same machine (local profiling).
The build starts normally :
$ MAVEN_OPTS="-agentpath:/opt/jprofiler8/bin/linux-x64/libjprofilerti.so=port=8849" mvn verify
JProfiler> Protocol version 39
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> 64-bit library
JProfiler> Listening on port: 8849.
JProfiler> Instrumenting native methods.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Waiting for a connection from the JProfiler GUI ...
JProfiler> Using dynamic instrumentation
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building...
[...]
and also ends normally :
[...]
Results :
Tests run: 2766, Failures: 0, Errors: 0, Skipped: 0
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19:31 min
[INFO] Finished at: 2014-06-18T11:38:49+01:00
[INFO] Final Memory: 21M/107M
[INFO] ------------------------------------------------------------------------
JProfiler> Keeping VM alive until frontend disconnects.
JProfiler Hot Spots CPU view show me this :
As for me, it is useless stuff, only maven related methods (zipping, class loading).
When I try to go through (open an hotspot backtrace), I don't find anything related to the tests I run.
Moreover the mesured elapsed time (if I add the top 10 hotspots inherent time) is largely insignificant (~10s
) compared to the actual total time (~19 mins 30s
).
EDIT:
At first, I ran the tests profiling with my IDE (IntelliJ IDEA) and the JProfiler plugin but I stopped because of a strange behavior. It seemed like the tests were running forever without doing anything. I supposed this was coming from the IDE (or the plugin) because the tests run fine through maven.
EDIT 2:
Thanks to @IngoKegel suggestion, if I select "All states" I have more information :
I see 4 more hot spots. However, they still don't give me usable information :
- is a "filtered/direct call" to j.u.c.ThreadPoolExecutor$Worker.run
- is a single call from Maven (plexus) to j.l.r.Method.invoke (+ insignificant calls)
- and 4. are "filtered/direct call" to o.a.maven.p.surefire.booterclient.o.ThreadStreamConsumer$Pumper.run
The elapsed time is a lot better, but I still don't see anything coming from "my" classes.
Why are my classes still filtered ? Is there a way to see them ?
Additionally, I don't fully understand why these hot spots don't show when selecting "Runnable" states. Moreover it's the default option...
Surprisingly, if I add the these top 4 elapsed time it gives me ~1h
but execution is ~19min 20s
as if some Hotspots were overlapping. I think it's a side effect of the "All states" option.