RFR: 8259774: samplethreads option does not work for jfr thread sampler

Yang Yi github.com+5010047+kelthuzadx at openjdk.java.net
Wed Jan 20 05:38:51 UTC 2021


On Fri, 15 Jan 2021 04:25:20 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

>> Thanks to your explanation, it makes sense. I have some ideas about this option. I noticed that the current implementation of thread sampling is to traverse threads from ThreadsList and do sampling. The consequence of this is that the sampling event in the recording file becomes very confusing, and it is difficult for users to find what they expect. If the user expects to know the callings of a certain thread in a period, this is impossible, because the sampling event of this thread is not continuous. So I wonder if there is a way for users to specify the thread they want to sample, for example:
>> $ jstack
>> // get thread id that expectes to know
>> $ jcmd pid JFR.configure samplethreads=<tid>
>
> There is no way to specify the thread. 
> 
> It is possible to reduce the period to 1 ms to increase the number samples. It might help to troubleshoot the issue, but it will also create lots of additional events for all threads. We have thought about adding per thread capabilities, like filtering or recording all events for a particular thread, but the main obstacle has been how to configure such a system. 
> 
> Plan is to simplify event configuration on command line and then see what features it will "unlock".

Based on @egahlin 's comment and @mgronlun 's comment on JBS:

> I think this request should be transformed into deprecating and removing the "samplethreads" option. It was introduced in 7u40 as an opt-out because thread sampling was new and incomplete. [mgronlun]

> The flag should really be removed. Could be it is still there because it has not yet gone through deprecation process. [egahlin]

I'm glad to deprecate this option, but I don’t know if it’s appropriate for me to do this deprecation work, i.e, will it break your existing deprecating process if I try to deprecate this option right now?

-------------

PR: https://git.openjdk.java.net/jdk/pull/2079


More information about the hotspot-jfr-dev mailing list