[gtk/tracing: 13/16] gsk: Add tracing to the gl renderer



commit b09a0958a0515d6bb261bc65a017a62936abbf56
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 19 20:25:17 2018 +0100

    gsk: Add tracing to the gl renderer
    
    Emit the equivalent of the cpu-time counter in the inspector.

 gsk/gl/gskglrenderer.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 29e8172aa5..2902e8a82a 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -21,6 +21,7 @@
 
 #include "gdk/gdkgltextureprivate.h"
 #include "gdk/gdkglcontextprivate.h"
+#include "gdk/gdkprofilerprivate.h"
 
 #include <epoxy/gl.h>
 #include <cairo-ft.h>
@@ -3008,7 +3009,7 @@ gsk_gl_renderer_do_render (GskRenderer           *renderer,
   gsize buffer_size;
 #ifdef G_ENABLE_DEBUG
   GskProfiler *profiler;
-  gint64 gpu_time, cpu_time;
+  gint64 gpu_time, cpu_time, start_time;
 #endif
 
 #ifdef G_ENABLE_DEBUG
@@ -3116,6 +3117,7 @@ gsk_gl_renderer_do_render (GskRenderer           *renderer,
 #ifdef G_ENABLE_DEBUG
   gsk_profiler_counter_inc (profiler, self->profile_counters.frames);
 
+  start_time = gsk_profiler_timer_get_start (profiler, self->profile_timers.cpu_time);
   cpu_time = gsk_profiler_timer_end (profiler, self->profile_timers.cpu_time);
   gsk_profiler_timer_set (profiler, self->profile_timers.cpu_time, cpu_time);
 
@@ -3123,6 +3125,10 @@ gsk_gl_renderer_do_render (GskRenderer           *renderer,
   gsk_profiler_timer_set (profiler, self->profile_timers.gpu_time, gpu_time);
 
   gsk_profiler_push_samples (profiler);
+
+  if (gdk_profiler_is_running ())
+    gdk_profiler_add_mark (start_time, cpu_time, "render", "");
+
 #endif
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]