captured java thread name

Erik Gahlin erik.gahlin at oracle.com
Mon Mar 9 13:32:56 UTC 2020


Hi Milan,

We are aware of the problem.

Thread information, such as the name, is stored in a checkpoint event 
where an ID maps to a thread "struct" where one field is the name.  In 
the event, such as ObjectAllocationOutsideTLAB, only the ID is written 
and the parser can then stitch the struct together with the ID.

This keeps overhead low and works well for most thread related 
information, i.e. thread group and OS thread id, but not for the thread 
name. Creating a new ID when the thread name changes would mean the 
thread identity can't be tracked. Writing a new checkpoint when the name 
changes, would mean that a parser would need to have a time dependent 
ID. This is something that existed in JDK 8, but was never exploited 
because of the complexity it brings to the parser.

It would be possible to create a ThreadRename event, but we have not 
done so, because we like to come up with a better solution. Also, 
changing thread name can be hard for a GUI to visualize anyway, i.e. 
what name should be chosen in a histogram that aggregates data for many 
events?

Have you considered adding a custom event with the context you want to 
track, or is it a third party library that you don't have control over?

Thanks
Erik

On 2020-03-09 13:56, Milan Mimica wrote:

> Hi list
>
> I would like to capture the thread name at the point in time
> jdk.ObjectAllocationOutsideTLAB event occurred. It helps me to track
> the context in which the allocation happens.
>
> Here is the example program https://pastebin.com/b2FTTiwm
>
> It doesn't work. It captures thread name at some later point in time.
> Can this be improved?
>


More information about the hotspot-jfr-dev mailing list