Recently I’ve incorporated Perf4j for runtime performance statistics on a number of projects, combined with our in-house counters and other standard libs (actually I quite like the annotation-style logging of perf-stats, and the tag-name rollup conventions, and will probably retrofit both into our existing collection tools). I had a bit of difficulay initially getting AspectJ to do CTW for the collection (and in retrospect, very much want to investivate the agent-based LTW approach, since it’d give us the ability to flip on/off recording, while it should be basically just as fast except on object creation – which for Spring/Singleton instantiated services (most of our performance code) is not significant.
Anyhow, the meat, plugin config below:
<!-- use this goal to weave all your main classes -->
<!-- use this goal to weave all your test classes -->
Also dependencies (we use Log4j, though we’re looking at Logback as well):
Performance note: We did some unit testing of methods which were instrumented/non-instrumented (our unit test basically spewed out a couple thousand garbage string+ints in a loop, which was instrumented or not)
We saw something like 3x the number of minor GCs (though GC was still fast) – no additional major GCs after adding Perf4j. Overall execution time was higher as well, though not by the same degree.