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

Vladimir Ivanov vlivanov at openjdk.org
Sat Jun 1 05:54:05 UTC 2024


On Thu, 30 May 2024 00:25:52 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> This still seems convoluted to me. A -Xlog option shouldn't control anything but logging. If you want a set of counters enabled then use the flag to enable them, and separately use -Xlog:init to print them (though whether "init" is appropriate here is another matter). You could use -Xlog:init+foo to be more selective about which counters.
>
> I've modified the fix so that the user needs to specify both `-Xlog:init` and `-XX:+ProfileClassLinkage` for the counters to be printed.

IMO a dedicated flag (`ProfileClassLinkage`) is well-justified here. `-Xlog:init` prints some data which is not collected by default. So, if a user explicitly specifies `-Xlog:init`, the expectation is JVM automatically enables relevant profiling logic. There's no need to require a user to explicitly specify another flag. 

(The main reason the data is not collected by default, unlike most of PerfData counters, is because Calvin spotted some negative effects on startup when profiling is turned on.)

Speaking of the extra flag itself, it can be achieved solely by consulting whether `-Xlog:init` is enabled or not (replace `ProfileClassLinkage` with `log_is_enabled(Info, init)` checks). But I find it clearer and more convenient to control profiling logic with a dedicated flag. As a bonus, it fits nicely with the rest of PerfData framework: when `-XX:+ProfileClassLinkage` is specified w/o `-Xlog:init`, it is still possible to dump the data using external tools (jcmd and jstat).

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

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


More information about the hotspot-dev mailing list