RFR: 8351925: JFR: Microsecond time format precision for JFR tool

Aleksey Shipilev shade at openjdk.org
Thu Mar 13 10:29:02 UTC 2025


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 = [...]
}


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.

After the patch:


jdk.ThreadSleep {
  startTime = 11:23:32.314580 (2025-03-13)
  duration = 100 ms
  time = 100 ms
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [...]
}


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.

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

Commit messages:
 - Fix

Changes: https://git.openjdk.org/jdk/pull/24029/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24029&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8351925
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/24029.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24029/head:pull/24029

PR: https://git.openjdk.org/jdk/pull/24029


More information about the hotspot-jfr-dev mailing list