RFR: 8338139: {ClassLoading, Memory}MXBean::isVerbose methods are inconsistent with their setVerbose methods [v2]

Stefan Karlsson stefank at openjdk.org
Tue Aug 20 06:18:59 UTC 2024


On Mon, 19 Aug 2024 22:22:26 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Wait. This is not what the implementation does. If you specify -Xlog:gc and -Xlog:gc+init (using a real tag instead of foo), `get_verbose` will return true. It only cares about the tag set that is exactly 'gc' and ignores the 'gc+init' tag set.
>> 
>> I'm adding a test line to show that.
>
> So in this test case:
>     `-Xlog:gc,gc+init`
> you have it so that `true` is returned.
> 
> With this line of code:
>  ```
>    const bool is_gc_exact_match = ts->contains(LogTag::_gc) && ts->ntags() == 1;
> 
> I would thing that this part is `false`: `ts->ntags() == 1`
> for the `-Xlog:gc,gc+init` test case so we'll be returning `false`.
> 
> What am I missing?

The important part is that `ts` contains one single tag set and that `gc,gc+init` is a string that specifies the two tag sets `gc` and `gc+init`. Also, note that `-Xlog:gc,gc+init` and `-Xlog:gc -Xlog:gc+init` is effectively the same.

It is also important to understand that the for loop iterates over all tag sets that have been used in the HotSpot code. It is not iterating over the tag sets specified by -Xlog lines.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20628#discussion_r1722741441


More information about the serviceability-dev mailing list