views:

251

answers:

2

Can anyone explain the science behind the sampling functionality of visualvm ?

I would have thought that collecting the amount of CPU spent on each particular method would require instrumenting the application to be profiled, but it doesnt look like visualvm is doing any kind of instrumenting, so I'm curious to know how it's done...

+3  A: 

It looks like the new VisualVM-Sampler plugin gather performance and memory data by periodically polling the monitored application for thread dumps or memory histograms. Check this article for more details.

Pascal Thivent
Not sure specifically about VisualVM, but I think sampling the call stack(s) is generally the most common profiling method unless for some reason you really need accurate timings about very specific methods.
Neil Coffey
A: 

When I start memory profiling JVisualVM spends a couple of seconds with instrumenting all the classes; at least that’s what it says it’s doing.

JVisualVM performing instrumentation

That sure looks like instrumentation to me. :)

Bombe
I thought the OP was asking about CPU :)
Pascal Thivent
The profiling plugin does instrument, but the sampling plugin does not.
elec