Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7903916

JMH: Faster self-PID getters

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • None
    • tools
    • None
    • jmh

      In current GHA, macos-aarch64 runners are extremely slow. There is about 5 second delay between the last two lines:

      ```
      Tue, 17 Dec 2024 11:20:33 GMT Forking using command: [/Users/runner/hostedtoolcache/Java_Corretto_jdk/21.0.5-11.1/arm64/Contents/Home/bin/java, -XX:+UnlockDiagnosticVMOptions, -XX:+UnlockExperimentalVMOptions, -DcompilerBlackholesEnabled=true, -XX:CompileCommandFile=/var/folders/3s/b36dp_4s3wv3byw057j8bp940000gn/T/jmh8396366506527642092compilecommand, -cp, /Users/runner/work/gha-perf-test/gha-perf-test/target/test-classes:/Users/runner/work/gha-perf-test/gha-perf-test/target/classes:/Users/runner/.m2/repository/junit/junit/4.13.1/junit-4.13.1.jar:/Users/runner/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/runner/.m2/repository/org/openjdk/jmh/jmh-core/1.37/jmh-core-1.37.jar:/Users/runner/.m2/repository/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:/Users/runner/.m2/repository/org/apache/commons/commons-math3/3.6.1/commons-math3-3.6.1.jar:/Users/runner/.m2/repository/org/openjdk/jmh/jmh-generator-annprocess/1.37/jmh-generator-annprocess-1.37.jar:, org.openjdk.jmh.runner.ForkedMain, 127.0.0.1, 49183]
      Tue, 17 Dec 2024 11:20:33 GMT # Fork: 1 of 1
      Tue, 17 Dec 2024 11:20:40 GMT # Warmup Iteration 1: 1345765548.585 ops/s
      ```

      I figured there is a problem in `Utils.getPID()` that ends up resolving its own hostname as part of `ManagementFactory.getRuntimeMXBean().getName()` call. We can do better and shortcut this.

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: