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

Remove PerfData sampling via StatSampler

XMLWordPrintable

    • b26

      PerfData contains a periodic task (the StatSampler) the samples and writes a small number of counters to the PerfData file. This mechanism was introduced many years ago but has remained largely unused and redundant.
      - For G1 and ZGC, it only records the current time.
      - For Serial and Parallel, it updates heap usage counters, but these are already updated after each GC cycle.
      - The sampled timestamp is rarely used.
      - The controlling flag, -XX:PerfDataSamplingInterval is obscure and poorly documented.
      This functionality adds overhead and complexity for little to no benefit.

      This change removes the following:
      - The StatSampler periodic task.
      - The associated sampling logic in PerfData
      - The -XX:PerfDataSamplingInterval flag, which is obsoleted in JDK 25, marked for removal in JDK 26.

      In addition:
      - The sun.os.hrt.ticks PerfData counter (the sampled timestamp), has been removed.
      - jstat -t has been updated to compute current timestamps instead of relying on the sampled timestamp.
      - The Eden usage counter for Serial and Parallel will always report 0, since eden is empty after each collection.


      This change only affects tools that read directly from the PerfData file, such as jstat. Other monitoring tools relying on other mechanisms remain unaffected.

      Using the flag in JDK 25 will produce an error:
      java -XX:PerfDataSamplingInterval=10 --version
      OpenJDK 64-Bit Server VM warning: Ignoring option PerfDataSamplingInterval; support was removed in 25.0

      And will not work in JDK 26 onwards:
      java -XX:PerfDataSamplingInterval=10 --version
      Unrecognized VM option 'PerfDataSamplingInterval=10'

            cnorrbin Casper Norrbin
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: