clutter/frame-clock: Add lateness to dispatch trace

To diagnose when missed frames are caused by dispatch being delayed
rather than repaint scheduling producing the wrong dispatch time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1928>
This commit is contained in:
Ivan Molodetskikh 2021-12-14 12:33:31 +03:00
parent 986658ade9
commit 17bb0a3de4

View File

@ -657,8 +657,14 @@ clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock,
ClutterFrameResult result;
int64_t ideal_dispatch_time_us, lateness_us;
#ifdef COGL_HAS_TRACING
int64_t this_dispatch_ready_time_us;
COGL_TRACE_BEGIN_SCOPED (ClutterFrameClockDispatch, "Frame Clock (dispatch)");
this_dispatch_ready_time_us = g_source_get_ready_time (frame_clock->source);
#endif
ideal_dispatch_time_us = (frame_clock->last_dispatch_time_us -
frame_clock->last_dispatch_lateness_us) +
frame_clock->refresh_interval_us;
@ -719,6 +725,17 @@ clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock,
}
break;
}
#ifdef COGL_HAS_TRACING
if (this_dispatch_ready_time_us != -1 &&
G_UNLIKELY (cogl_is_tracing_enabled ()))
{
g_autofree char *description = NULL;
description = g_strdup_printf ("dispatched %ld µs late",
time_us - this_dispatch_ready_time_us);
COGL_TRACE_DESCRIBE (ClutterFrameClockDispatch, description);
}
#endif
}
static gboolean