30 ms·
This of course relies on Java's reflection ability, in this case, an API to retrieve stack traces for all threads dynamically. An interesting question is how th
by grumpyprole 4y ago
This of course relies on Java's reflection ability, in this case, an API to retrieve stack traces for all threads dynamically. An interesting question is how this is implemented and how regular invocation might affect the runtime (e.g. global locks).
- parttimenerd 4y ago(Author here) It's not about Java's ability to do reflection, many languages expose the ability to get stack-traces. It's usually used for logging and exceptions. But I could certainly write a blog post on how stack-walking is implemented for the likes of async-profiler, as I'm currently working on a new stack-walking API for Java (JEP 435).
- grumpyprole 4y ago> It's usually used for logging and exceptions. That's why I was querying it's suitability for profiling. The time to get a lock for a global "safepoint" and then release it must be significant no?
- parttimenerd 4y agoIt's not as significant as one might think (the JVM uses it internally for GC and other things). The main problem is the bias it leads to in profiling and that the time-to-safepoint can sporadically be in the tens of milliseconds with is not great.