RFR: 8330198: Add some class loading related perf counters to measure VM startup [v8]
David Holmes
dholmes at openjdk.org
Mon Jun 10 08:01:17 UTC 2024
On Fri, 7 Jun 2024 16:11:36 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:
>> Adding a few perf counters related to class loading to measure VM startup. The counters are only active if the user specifies `-Xlog:init` in the command line. A diagnostic flag `ProfileClassLinkage` is added to control the new counters. The flag is set to false by default and will be enabled if `-Xlog:init` is specified.
>>
>> This change is already in the leyden/premain branch. There are more counters in the branch to measure other stuff. For now, just upstreaming class loader related counters.
>>
>> Refer to the [comment](https://bugs.openjdk.org/browse/JDK-8330198?focusedId=14665311&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14665311) in the bug report for an example output.
>>
>> Passed tiers 1 - 4 testing.
>
> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
>
> remove Arguments::perf_class_link()
I can't decide whether using the logging state to control the counter initialization as well as their printing is clever, or combining things the wrong way.
When you have additional counters enabled by slightly different logging settings, I can't see how you will compose things.
I also still wonder about the overhead of the empty perf timer events in heavy duty classloading applications.
src/hotspot/share/interpreter/linkResolver.cpp line 1735:
> 1733:
> 1734: PerfTraceTimedEvent timer(ClassLoader::perf_resolve_invokehandle_time(),
> 1735: ClassLoader::perf_resolve_invokehandle_count());
What does this do when the counters are not enabled?
src/hotspot/share/runtime/java.cpp line 160:
> 158: }
> 159:
> 160: void log_vm_stats(outputStream *st) {
I assume this generic name is because in the future it will print a lot more VM stats?
src/hotspot/share/runtime/java.cpp line 164:
> 162: if (log.is_enabled()) {
> 163: ClassLoader::print_counters(st);
> 164: }
Probably worth adding a comment here as to why we actually print to the passed in stream and not the log stream., given we check if the log stream is enabled. Someone could easily think this is a typo/bug.
src/hotspot/share/runtime/threads.cpp line 835:
> 833: log.print_cr("At VM initialization completion:");
> 834: log_vm_stats(&log);
> 835: }
If we are going to have more types of VM stats in the future, it is not clear how you will change this if-condition? Nor what stream you would pass in. ???
-------------
PR Review: https://git.openjdk.org/jdk/pull/18790#pullrequestreview-2106917892
PR Review Comment: https://git.openjdk.org/jdk/pull/18790#discussion_r1632745676
PR Review Comment: https://git.openjdk.org/jdk/pull/18790#discussion_r1632753151
PR Review Comment: https://git.openjdk.org/jdk/pull/18790#discussion_r1632756003
PR Review Comment: https://git.openjdk.org/jdk/pull/18790#discussion_r1632761703
More information about the hotspot-dev
mailing list