[gtk/tracing: 1333/1335] gsk: Add tracing to the gl renderer



commit e95b52bd410f077bfaf5f6fe2ca8307af7a256e4
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 6e7abbc3e1..d55a9faad2 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -19,6 +19,7 @@
 #include "gskprivate.h"
 
 #include "gdk/gdkgltextureprivate.h"
+#include "gdk/gdkprofiler.h"
 
 #include <epoxy/gl.h>
 #include <cairo-ft.h>
@@ -2720,7 +2721,7 @@ gsk_gl_renderer_do_render (GskRenderer           *renderer,
   graphene_matrix_t modelview, projection;
 #ifdef G_ENABLE_DEBUG
   GskProfiler *profiler;
-  gint64 gpu_time, cpu_time;
+  gint64 gpu_time, cpu_time, start_time;
 #endif
 
 #ifdef G_ENABLE_DEBUG
@@ -2819,6 +2820,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);
 
@@ -2826,6 +2828,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]