-
Notifications
You must be signed in to change notification settings - Fork 5
Description
It's fairly crucial for most tools looking to analyse OA metrics that the timestamps can be mapped on to some wall clock timeline, and more specifically correlated with system clocks like CLOCK_MONOTONIC so that other interesting system events can be correlated with work happening on the gpu.
The rough plan for this so far, talking with Sourab Gupta (@sourabgu) is that we can provide a way to open a stream requesting timestamps to be included in samples with a specific clockid_t. Then within the i915 perf driver we will periodically read the gpu timestamp via mmio and the system clock, with interrupts disabled (probably via a hrtimer once per second) to be able to determine a more accurate frequency for the gpu timestamps than the documented constants we have (empirically these have proven to be very in precise, leading to significant drifting when trying to plot the timestamps with respect to wall clock time).
As we forward samples to userspace we can use the OA report timestamps, the most recently correlated (gpu, system) timestamp pair and the calculated gpu timestamp frequency to interpolate a corresponding system clock value.