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

David Holmes dholmes at openjdk.org
Thu Jun 13 02:27:17 UTC 2024


On Wed, 12 Jun 2024 05:23:41 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 log_vm_stats()

Changes requested by dholmes (Reviewer).

src/hotspot/share/runtime/java.cpp line 362:

> 360:   if (log_is_enabled(Info, perf, class, link)) {
> 361:       ClassLoader::print_counters(tty);
> 362:   }

Again this needs to comment why we check the log is active but write to tty instead of the logstream.

Or we could put the `log_is_enabled` check inside `print_counters` rather than require callers to do it. That also allows us to print that the counters are disabled eg.

void ClassLoader::print_counters(outputStream *st) {
  // The counters are only active if the logging is enabled, but
  // we print to the passed in outputStream as requested.
  if (log_is_enabled(Info, perf, class, link)) {
    st->print_cr("ClassLoader:");
    ...
  } else {
    st->print_cr("ClassLoader: <not enabled>");
  }

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

PR Review: https://git.openjdk.org/jdk/pull/18790#pullrequestreview-2114548996
PR Review Comment: https://git.openjdk.org/jdk/pull/18790#discussion_r1637396085


More information about the hotspot-dev mailing list