jvm-profiling-tools / honest-profiler

A sampling JVM profiler without the safepoint sample bias
https://github.com/RichardWarburton/honest-profiler/wiki
MIT License
1.25k stars 146 forks source link

document in the wiki how samples are collected #124

Closed ceeaspb closed 7 years ago

ceeaspb commented 8 years ago

Although it is documented elsewhere (ie. http://jeremymanson.blogspot.co.uk/2010/07/why-many-profilers-have-serious.html and other posts etc etc), say how samples are collected. Possibly contrast against other profilers like jstack, bytecode instrumenters, Oracle Solaris Studio Performance Analyzer and others.

ie. correct me where I am wrong: SIGPROF signal happens on an interval interrupts 1 thread only gets a sample iff jvmti will return one, else it was garbled or the jvm was doing something else other than running java code, gc etc.

so: it's an on cpu sampler only 1 thread is sampled per interval (not all) and the sampler might run on a non-java thread in which case there won't be a java stack to collect

Maybe it's a more detailed section to https://github.com/RichardWarburton/honest-profiler/wiki/Motivation , or somewhere else in the wiki.

Thinking about it, given it's only sampling 1 thread at a time and some samples will be rejected because they are non-java there is still a bias (which could be large) there that isn't present in for example Oracle Solaris Studio Performance Analyzer which will report the GC thread stacks etc (or it did last time I used it some years back). #97 could mitigate the risk of that bias somewhat.

RichardWarburton commented 8 years ago

That's a good idea, perhaps we could also link to some talks given by @nitsanw and I, or his blog post on the subject as well which offer a lot of background information.

ceeaspb commented 8 years ago

agree that would be great

nitsanw commented 8 years ago

I'm happy to do this, as I'm in the process of writing a post on AsyncGetCallTrace type profilers. It is taking me a while, but I should be able to cover this here + blog post in the next few weeks.

ceeaspb commented 8 years ago

thanks @nitsanw

nitsanw commented 7 years ago

see here: https://github.com/RichardWarburton/honest-profiler/wiki/How-are-samples-collected-by-honest-profiler