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

Erik Gahlin egahlin at openjdk.org
Fri Mar 14 16:19:59 UTC 2025


On Thu, 13 Mar 2025 10:24:08 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> 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.

The default mode (PrettyWriter) aims to present human-readable output, striking a balance between clarity and concision. For more detailed information, including timestamps and time spans with nine-digit precision, `jfr print --json` is available as an alternative.

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

PR Comment: https://git.openjdk.org/jdk/pull/24029#issuecomment-2725159598


More information about the hotspot-jfr-dev mailing list