RFR: 8259774: samplethreads option does not work for jfr thread sampler
Yang Yi
github.com+5010047+kelthuzadx at openjdk.java.net
Fri Jan 15 02:31:03 UTC 2021
On Thu, 14 Jan 2021 15:40:32 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
>> Hi,
>>
>> Please help review this minor change that lets the JFR option
>> `samplethreads` works.
>>
>> In the current implementation, no matter whether `samplethreads`
>> option is turned on or off, it will not affect thread sampling.
>> The sampler completely ignores it. This patch will address this
>> problem and let the sampler aware of this option.
>
> The samplethreads option was added in 7u40 as an easy way to disable method profiling.
>
> This was when the feature was new and we had spurious crashes when walking thread stacks. It allowed us to disable the features in our test infrastructure. We later fixed the issue. If we get a crash, we have a crash handlar that will allow us to continue. We kept the flag for a few releases, as a workaround for customers if they would run into issues. AFAIK, this has never been the case?
>
> The flag should really be removed. Could be it is still there because it has not yet gone through deprecation process.
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>
-------------
PR: https://git.openjdk.java.net/jdk/pull/2079
More information about the hotspot-jfr-dev
mailing list