@andy.fingerhut IIRC jstat -gccause <PID> <POLLTIME>
you can use it on any JVM your user is running, without passing any fancy JVM args. Might be useful, also see man jstat
for tweaking what is displayed
Thanks for that. I will check it out. I'm currently being a bit stubborn in continuing to look for a way to get such stats from within the JVM that is doing the performance tests, too. Hopefully it isn't a big ordeal to find a way to do that.
the above does that. It’s a lightweight command line tool that connects to the JVM you specify and dumps gc stats as an ascii table, 1 row per POLLTIME, e.g. a polltime of 1000
would be every second.
Doing some more digging, it seems that there may be a bug in criterium that for some calls, causes System/gc to be called just before each execution of your expression you want to benchmark. The GarbageCollectorMXBean measurements I was taking were at the beginning and end of my expression, which was not including those System/gc calls executed by criterium at all.
I opened a PR on the criterium library proposing a fix for that. The fix enables you to still request that behavior as an option, but it does not appear to be intended as the default.
It is so mentally relaxing for me to find the root cause of weird stuff like this. The world makes sense again 🙂