diff options
author | Matthias Clasen <mclasen@redhat.com> | 2016-02-28 15:39:05 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-02-28 21:40:23 -0500 |
commit | 2801f3c8431c0516f56fa8acb86f51f41b515602 (patch) | |
tree | 40261357e139f2a46eb942a44f333cd05c97f3fe /gdk/gdkframeclock.c | |
parent | b1d691dbfd9a778197fe0995f15a0520d5928a63 (diff) | |
download | gtk+-2801f3c8431c0516f56fa8acb86f51f41b515602.tar.gz |
gdk: Don't use g_print for debug output
The g_print documentation explicitly says not to do this, since
g_print is meant to be redirected by applications. Instead use
g_message for logging that can be triggered via GTK_DEBUG.
Diffstat (limited to 'gdk/gdkframeclock.c')
-rw-r--r-- | gdk/gdkframeclock.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/gdk/gdkframeclock.c b/gdk/gdkframeclock.c index 3cf49ca65f..9399ab9f06 100644 --- a/gdk/gdkframeclock.c +++ b/gdk/gdkframeclock.c @@ -493,6 +493,8 @@ void _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock, GdkFrameTimings *timings) { + GString *str; + gint64 previous_frame_time = 0; GdkFrameTimings *previous_timings = gdk_frame_clock_get_timings (clock, timings->frame_counter - 1); @@ -500,25 +502,29 @@ _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock, if (previous_timings != NULL) previous_frame_time = previous_timings->frame_time; - g_print ("%5" G_GINT64_FORMAT ":", timings->frame_counter); + str = g_string_new (""); + + g_string_append_printf (str, "%5" G_GINT64_FORMAT ":", timings->frame_counter); if (previous_frame_time != 0) { - g_print (" interval=%-4.1f", (timings->frame_time - previous_frame_time) / 1000.); - g_print (timings->slept_before ? " (sleep)" : " "); + g_string_append_printf (str, " interval=%-4.1f", (timings->frame_time - previous_frame_time) / 1000.); + g_string_append_printf (str, timings->slept_before ? " (sleep)" : " "); } if (timings->layout_start_time != 0) - g_print (" layout_start=%-4.1f", (timings->layout_start_time - timings->frame_time) / 1000.); + g_string_append_printf (str, " layout_start=%-4.1f", (timings->layout_start_time - timings->frame_time) / 1000.); if (timings->paint_start_time != 0) - g_print (" paint_start=%-4.1f", (timings->paint_start_time - timings->frame_time) / 1000.); + g_string_append_printf (str, " paint_start=%-4.1f", (timings->paint_start_time - timings->frame_time) / 1000.); if (timings->frame_end_time != 0) - g_print (" frame_end=%-4.1f", (timings->frame_end_time - timings->frame_time) / 1000.); + g_string_append_printf (str, " frame_end=%-4.1f", (timings->frame_end_time - timings->frame_time) / 1000.); if (timings->presentation_time != 0) - g_print (" present=%-4.1f", (timings->presentation_time - timings->frame_time) / 1000.); + g_string_append_printf (str, " present=%-4.1f", (timings->presentation_time - timings->frame_time) / 1000.); if (timings->predicted_presentation_time != 0) - g_print (" predicted=%-4.1f", (timings->predicted_presentation_time - timings->frame_time) / 1000.); + g_string_append_printf (str, " predicted=%-4.1f", (timings->predicted_presentation_time - timings->frame_time) / 1000.); if (timings->refresh_interval != 0) - g_print (" refresh_interval=%-4.1f", timings->refresh_interval / 1000.); - g_print ("\n"); + g_string_append_printf (str, " refresh_interval=%-4.1f", timings->refresh_interval / 1000.); + + g_message ("%s", str->str); + g_string_free (str, TRUE); } #endif /* G_ENABLE_DEBUG */ |