RFR: 8330198: Add some class loading related perf counters to measure VM startup [v4]

Calvin Cheung ccheung at openjdk.org
Thu May 30 00:32:19 UTC 2024


On Wed, 29 May 2024 07:26:51 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> This function will cover other sets of counters in the future. Maybe changing its name to `log_vm_stats`?
>
> Regardless there seems to be confusion about which method should be responsible for checking if the requisite logging is enabled. They should not both do it.

I've changed `log_vm_stats` to check if both `-Xlog:init` and `-XX:+ProfileClassLinkage` are enabled before calling `ClassLoader::print_counters`. In `print_counters`, assert statements are added to ensure both are enabled.

>> If using `tty`,  the output would lose the logging tag. The output would look as follows:
>> 
>> ClassLoader:
>>   clinit:               11ms / 285 events
>>   link methods:         13ms / 7493 events
>>   method adapters:      12ms / 571 events
>> 
>> versus with logging tag:
>> 
>> [0.094s][info][init] ClassLoader:
>> [0.094s][info][init]   clinit:               11ms / 278 events
>> [0.094s][info][init]   link methods:         13ms / 7336 events
>> [0.094s][info][init]   method adapters:      12ms / 571 events
>
> Yes I understand that, but this method is generally printing a ton of stuff to the tty - that is what it is for. If we want to add such stuff to the output then it too should just go to the tty - else it doesn't belong in this method IMO.

With my new modified fix, the `log_vm_stats` accepts a `outputStream *st` argument so that in `java.cpp` a `tty` would be passed in. In `threads.cpp`, a `LogStreamHandle` could be passed in.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18790#discussion_r1619630383
PR Review Comment: https://git.openjdk.org/jdk/pull/18790#discussion_r1619630458


More information about the hotspot-dev mailing list