Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8354257

xctracenorm profiler not working with JDK JMH benchmarks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 25
    • infrastructure
    • None

      Running the xctracenorm profiler on benchmarks generated in the JDK project fails with "Cannot invoke "java.io.InputStream.read(byte[])" because "fis" is null" error:

      ```
      Running tests using MICRO control variable 'OPTIONS=-p probability=100 -jvmArgs -XX:-UseSuperWord -prof xctracenorm -v EXTRA;FORK=1'
      Test selection 'micro:org.openjdk.bench.java.lang.MinMaxVector.longReductionMultiplyMax', will run:
      * micro:org.openjdk.bench.java.lang.MinMaxVector.longReductionMultiplyMax

      Running test 'micro:org.openjdk.bench.java.lang.MinMaxVector.longReductionMultiplyMax'
      Profilers failed to initialize, exiting.
      java.lang.reflect.InvocationTargetException
      null
      Cannot invoke "java.io.InputStream.read(byte[])" because "fis" is null
      ```

      The issue happens because the benchmarks.jar that JDK build generates does not include `default.instruments.template.xml` resource that the JMH core jar includes:

      ```
      $ jar tf jdk/build/release-darwin-arm64/images/test/micro/benchmarks.jar | grep default.instruments
      <not output>
      ```

      A benchmarks.jar generated in a Maven JMH project does include it:

      ```
      $ ~/opt/boot-java-24/bin/jar tf benchmarks.jar | grep default
      default.instruments.template.xml
      ```

      A workaround that might work would be to pass in the `template` parameter to the profiler and point to the xml somewhere in the system.

            galder Galder ZamarreƱo
            galder Galder ZamarreƱo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: