mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
clutter/frame-clock: Add dispatch jitter to frame timing measurements
Dispatch jitter is how much the dispatch interval has changed between frames. It's a measure of sampling smoothness for events that are occurring at a higher rate than the screen is refreshing: * Mouse movement * Clients rendering at swap interval zero * Keyframe animation position Zero jitter is ideal but will practically never happen, and a jitter value of several thousand microseconds will be visible to the naked eye as stutter even if you're maintaining a perfect frame rate. To make the numbers easier to interpret we also log the jitter as a percentage of the refresh interval. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3082>
This commit is contained in:
parent
be0aa2976e
commit
e7a210d963
@ -116,6 +116,8 @@ struct _ClutterFrameClock
|
||||
|
||||
int n_missed_frames;
|
||||
int64_t missed_frame_report_time_us;
|
||||
|
||||
int64_t last_dispatch_interval_us;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ClutterFrameClock, clutter_frame_clock,
|
||||
@ -767,6 +769,19 @@ clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock,
|
||||
MAX (frame_clock->shortterm.max_dispatch_lateness_us,
|
||||
frame_clock->last_dispatch_lateness_us);
|
||||
|
||||
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (FRAME_TIMINGS)))
|
||||
{
|
||||
int64_t dispatch_interval_us, jitter_us;
|
||||
|
||||
dispatch_interval_us = time_us - frame_clock->last_dispatch_time_us;
|
||||
jitter_us = llabs (dispatch_interval_us -
|
||||
frame_clock->last_dispatch_interval_us);
|
||||
frame_clock->last_dispatch_interval_us = dispatch_interval_us;
|
||||
CLUTTER_NOTE (FRAME_TIMINGS, "dispatch jitter %5ldµs (%3ld%%)",
|
||||
jitter_us,
|
||||
jitter_us * 100 / frame_clock->refresh_interval_us);
|
||||
}
|
||||
|
||||
frame_clock->last_dispatch_time_us = time_us;
|
||||
g_source_set_ready_time (frame_clock->source, -1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user