RFR: 8330198: Add some class loading related perf counters to measure VM startup [v3]
Ioi Lam
iklam at openjdk.org
Fri Jun 7 02:56:14 UTC 2024
On Wed, 5 Jun 2024 22:22:11 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:
>>> -Xlog:init means "I want to see logs related to initialization", so it should enable all the counters for printing the related logs.
>>
>> I don't agree. Initialization logging could encompass many different things, some of which are individually controllable via different flags. Simply turning on init logging should not turn on all such flags. If you want that level of coupling then perhaps use init_counters (or something like that) to make it clear this is not a general log tag intended for any initialization code to use, but something you have chosen to tie to specific functionality.
>>
>>> We may add several groups of counters in the future. We don't want to force the user to enumerate all these counters
>>
>> It is not clear to me how you envisage that working. You want individual group switches plus a global one?
>
> @dholmes-ora, @iklam Could you review my latest commit?
> Thanks!
The latest version looks good to me. My only suggestion is to use `log_is_enabled(Info, perf, class, link)` directly, because it's very efficient.
To verify, I wrote a function like this:
void foo() {
if (log_is_enabled(Info, class, load)) {
tty->print_cr("Hello");
}
}
GCC compiles it to the following. So the test is implemented as a single load from memory.
_Z3foov:
.LFB8725:
.cfi_startproc
movq 64+_ZN16LogTagSetMappingILN6LogTag4typeE16ELS1_74ELS1_0ELS1_0ELS1_0ELS1_0EE7_tagsetE(%rip), %rax
testq %rax, %rax
je .L6
movq tty at GOTPCREL(%rip), %rax
leaq .LC0(%rip), %rsi
movq (%rax), %rdi
xorl %eax, %eax
jmp _ZN12outputStream8print_crEPKcz at PLT
ret
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18790#discussion_r1630565751
More information about the hotspot-dev
mailing list