gsk: Add tracing to the gl renderer

Emit the equivalent of the cpu-time counter in the inspector.
This commit is contained in:
Matthias Clasen 2018-05-19 20:25:17 +01:00
parent c541fa9555
commit b09a0958a0

View File

@ -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
}