I'm profiling application with btrace and faced with limitation. I try to get a name of current java.lang.Thread
. Normaly you can call getName()
but it's forbidden in btrace-scripts (any calls exception BTraceUtils
).
Is there any idea how to get String from char[]
?
The original task is check if name of thread contains sub-string and only then log out tracing info (reducing output).
just use the "built-in" function name(thread) from BTraceUtils. One of the types it takes as its argument is Thread and it returns the thread's name. Also, there is threadId(thread) function which returns the thread's ID.
You can find many useful function in the BTraceUtils class - check out the online javadoc.
Cheers,
JB