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

Correlating honest profile event thread id's with java thread id #245

Closed mridulm closed 6 years ago

mridulm commented 6 years ago

I am trying to correlate the thread id's emitted in profile events with java thread's id - based on collected honest profiler events and my own events I log (emitted periodically from the application). From what I understand, honest profiler's tid's are the native thread id and not Thread.getId()

Given this, is there any way to correlate the two ? Either find Thread.getId given honest profiler tid; or native tid given Thread.getId. (I will be within the relevant Thread when I emit the event - so Thread.currentThread.getId in my case)

One (possibly very bad ?) workaround I can think of is if gettid (from thread map) was exposed to java application, from the relevant thread I could make a jni call and map honest profiler thread id with java thread id while emitting events.

Any other suggestions or hints would be greatly appreciated ! Thanks