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

JFR: Microsecond time format precision for JFR tool

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 17, 21, 25
    • hotspot
    • jfr

      Currently, JFR tool formats the times with millisecond precision:

      ```
      jdk.ThreadSleep {
        startTime = 10:48:56.668 (2025-03-13)
        duration = 100 ms
        time = 100 ms
        eventThread = "main" (javaThreadId = 3)
        stackTrace = [
          NotifyWaitLatency.work() line: 20
          NotifyWaitLatency.main(String[]) line: 4
          jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Object, Object[]) line: 104
          java.lang.reflect.Method.invoke(Object, Object[]) line: 565
          com.sun.tools.javac.launcher.SourceLauncher.execute(MemoryContext, String[]) line: 254
        ]
      }
      ```

      In modern world, a lot can happen within a millisecond. So it would be better to default to microsecond precision. Both timesources supported by JFR (RDTSC and os::elapsed_counter()) have enough enough precision to satisfy microsecond output, so microseconds are meaningful.

      I think durations should also be more precise -- for example to compute the endTime precisely from (startTime+duration), but that is a more controversial/style question, so I would like to handle it separately.

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

              Created:
              Updated: