Add GDK_DEBUG=frames

Add a debug option to print out detailed statistics about each frame drawn.

https://bugzilla.gnome.org/show_bug.cgi?id=685460
This commit is contained in:
Owen W. Taylor
2012-11-14 19:21:33 -05:00
parent 9690567d50
commit 8855bf052d
7 changed files with 184 additions and 5 deletions

View File

@ -1155,6 +1155,11 @@ _gdk_wm_protocols_filter (GdkXEvent *xev,
gdk_frame_timings_set_refresh_interval (timings, refresh_interval);
gdk_frame_timings_set_complete (timings, TRUE);
#ifdef G_ENABLE_DEBUG
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
_gdk_frame_history_debug_print (gdk_frame_clock_get_history (clock),
timings);
#endif /* G_ENABLE_DEBUG */
}
}
}

View File

@ -322,6 +322,18 @@ gdk_x11_window_end_frame (GdkWindow *window)
if (impl->toplevel->current_counter_value % 2 == 1)
{
#ifdef G_ENABLE_DEBUG
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
{
XImage *image = XGetImage (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
0, 0, 1, 1,
(1 << 24) - 1,
ZPixmap);
XDestroyImage (image);
}
#endif /* G_ENABLE_DEBUG */
/* An increment of 3 means that the frame was not drawn as fast as possible,
* but rather at a particular time. This can trigger different handling from
* the compositor.