[gtk/ngl-clip-classification] Collect clip stats
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ngl-clip-classification] Collect clip stats
- Date: Mon, 8 Mar 2021 15:04:20 +0000 (UTC)
commit 03187cf4795d9d09d945bad7921f21d307c9fd04
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Mar 8 09:47:36 2021 -0500
Collect clip stats
gsk/ngl/gsknglrenderer.c | 4 ++++
gsk/ngl/gsknglrenderjob.c | 28 ++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
---
diff --git a/gsk/ngl/gsknglrenderer.c b/gsk/ngl/gsknglrenderer.c
index 66edc98d5d..41b0662a9c 100644
--- a/gsk/ngl/gsknglrenderer.c
+++ b/gsk/ngl/gsknglrenderer.c
@@ -286,6 +286,8 @@ gsk_ngl_renderer_dispose (GObject *object)
G_OBJECT_CLASS (gsk_ngl_renderer_parent_class)->dispose (object);
}
+extern void dump_clip_stats (void);
+
static void
gsk_ngl_renderer_class_init (GskNglRendererClass *klass)
{
@@ -298,6 +300,8 @@ gsk_ngl_renderer_class_init (GskNglRendererClass *klass)
renderer_class->unrealize = gsk_ngl_renderer_unrealize;
renderer_class->render = gsk_ngl_renderer_render;
renderer_class->render_texture = gsk_ngl_renderer_render_texture;
+
+ g_atexit (dump_clip_stats);
}
static void
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c
index aa038028c8..bd2aff0eb7 100644
--- a/gsk/ngl/gsknglrenderjob.c
+++ b/gsk/ngl/gsknglrenderjob.c
@@ -1030,10 +1030,38 @@ gsk_ngl_render_job_draw_offscreen_rect (GskNglRenderJob *job,
gsk_ngl_render_job_draw_coords (job, min_x, min_y, max_x, max_y);
}
+static guint64 clips[3];
+static guint64 total;
+
+static void
+clip_stats (GskNglRenderJob *job)
+{
+ total++;
+ if (job->current_clip->is_fully_contained)
+ clips[0]++;
+ else if (job->current_clip->is_rectilinear)
+ clips[1]++;
+ else
+ clips[2]++;
+}
+
+void dump_clip_stats (void);
+
+void
+dump_clip_stats (void)
+{
+ g_print ("%f%% no clip\n%f%%rect clip\n%f%% full clip\n",
+ clips[0]*100.0 / (double)total,
+ clips[1]*100.0 / (double)total,
+ clips[2]*100.0 / (double)total);
+}
+
static inline void
gsk_ngl_render_job_begin_draw (GskNglRenderJob *job,
GskNglProgram *program)
{
+ clip_stats (job);
+
job->current_program = program;
gsk_ngl_command_queue_begin_draw (job->command_queue,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]