mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
clutter/frame-clock: Debug log frame drops per second if there were any
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
This commit is contained in:
parent
135ed27d27
commit
f9802ca2a4
@ -111,6 +111,9 @@ struct _ClutterFrameClock
|
|||||||
int inhibit_count;
|
int inhibit_count;
|
||||||
|
|
||||||
GList *timelines;
|
GList *timelines;
|
||||||
|
|
||||||
|
int n_missed_frames;
|
||||||
|
int64_t missed_frame_report_time_us;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (ClutterFrameClock, clutter_frame_clock,
|
G_DEFINE_TYPE (ClutterFrameClock, clutter_frame_clock,
|
||||||
@ -240,6 +243,38 @@ clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
|
|||||||
COGL_TRACE_BEGIN_SCOPED (ClutterFrameClockNotifyPresented,
|
COGL_TRACE_BEGIN_SCOPED (ClutterFrameClockNotifyPresented,
|
||||||
"Frame Clock (presented)");
|
"Frame Clock (presented)");
|
||||||
|
|
||||||
|
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (FRAME_CLOCK)))
|
||||||
|
{
|
||||||
|
int64_t now_us;
|
||||||
|
|
||||||
|
if (frame_clock->is_next_presentation_time_valid &&
|
||||||
|
frame_info->presentation_time != 0)
|
||||||
|
{
|
||||||
|
int64_t diff_us;
|
||||||
|
int n_missed_frames;
|
||||||
|
|
||||||
|
diff_us = llabs (frame_info->presentation_time -
|
||||||
|
frame_clock->next_presentation_time_us);
|
||||||
|
n_missed_frames =
|
||||||
|
(int) roundf ((float) diff_us /
|
||||||
|
(float) frame_clock->refresh_interval_us);
|
||||||
|
|
||||||
|
frame_clock->n_missed_frames = n_missed_frames;
|
||||||
|
}
|
||||||
|
|
||||||
|
now_us = g_get_monotonic_time ();
|
||||||
|
if ((now_us - frame_clock->missed_frame_report_time_us) > G_USEC_PER_SEC)
|
||||||
|
{
|
||||||
|
if (frame_clock->n_missed_frames > 0)
|
||||||
|
{
|
||||||
|
CLUTTER_NOTE (FRAME_CLOCK, "Missed %d frames the last second",
|
||||||
|
frame_clock->n_missed_frames);
|
||||||
|
}
|
||||||
|
frame_clock->n_missed_frames = 0;
|
||||||
|
frame_clock->missed_frame_report_time_us = now_us;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef COGL_HAS_TRACING
|
#ifdef COGL_HAS_TRACING
|
||||||
if (G_UNLIKELY (cogl_is_tracing_enabled ()))
|
if (G_UNLIKELY (cogl_is_tracing_enabled ()))
|
||||||
{
|
{
|
||||||
|
@ -117,6 +117,7 @@ static const GDebugKey clutter_debug_keys[] = {
|
|||||||
{ "frame-timings", CLUTTER_DEBUG_FRAME_TIMINGS },
|
{ "frame-timings", CLUTTER_DEBUG_FRAME_TIMINGS },
|
||||||
{ "detailed-trace", CLUTTER_DEBUG_DETAILED_TRACE },
|
{ "detailed-trace", CLUTTER_DEBUG_DETAILED_TRACE },
|
||||||
{ "grabs", CLUTTER_DEBUG_GRABS },
|
{ "grabs", CLUTTER_DEBUG_GRABS },
|
||||||
|
{ "frame-clock", CLUTTER_DEBUG_FRAME_CLOCK },
|
||||||
};
|
};
|
||||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ typedef enum
|
|||||||
CLUTTER_DEBUG_FRAME_TIMINGS = 1 << 17,
|
CLUTTER_DEBUG_FRAME_TIMINGS = 1 << 17,
|
||||||
CLUTTER_DEBUG_DETAILED_TRACE = 1 << 18,
|
CLUTTER_DEBUG_DETAILED_TRACE = 1 << 18,
|
||||||
CLUTTER_DEBUG_GRABS = 1 << 19,
|
CLUTTER_DEBUG_GRABS = 1 << 19,
|
||||||
|
CLUTTER_DEBUG_FRAME_CLOCK = 1 << 20,
|
||||||
} ClutterDebugFlag;
|
} ClutterDebugFlag;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
Loading…
Reference in New Issue
Block a user