[mutter/gbsneto/tracing] clutter: Add more descriptive profiling sections



commit 008b04f408a881962b0a829b5d38e3c4db8d1fa2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Apr 12 17:19:31 2019 -0300

    clutter: Add more descriptive profiling sections
    
    The idea here is to be able to visualize and immediately
    understand what is happening. Something like:
    
    ```
                       [ view1 ] [ view2 ]
     [---- Layout ---][------ Paint ------][ Pick ]
    [================== Update =====================]
    ```
    
    But with colors. A few of the previous profiling data
    sections were removed, since they didn't really add to
    reading the graph.

 clutter/clutter/clutter-stage.c           | 34 +++++++++++++++----------------
 clutter/clutter/cogl/clutter-stage-cogl.c |  4 ----
 cogl/cogl/cogl-trace.h                    | 12 +++++------
 3 files changed, 23 insertions(+), 27 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index e552c8a8e..ae90b046c 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -633,8 +633,6 @@ clutter_stage_do_paint_view (ClutterStage                *stage,
   float viewport[4];
   cairo_rectangle_int_t geom;
 
-  COGL_TRACE_BEGIN_SCOPED (ClutterStageDoPaintView);
-
   _clutter_stage_window_get_geometry (priv->impl, &geom);
 
   viewport[0] = priv->viewport[0];
@@ -688,14 +686,12 @@ _clutter_stage_paint_view (ClutterStage                *stage,
 {
   ClutterStagePrivate *priv = stage->priv;
 
-  COGL_TRACE_BEGIN_SCOPED (ClutterStagePaintView);
-
   if (!priv->impl)
     return;
 
-  clutter_stage_do_paint_view (stage, view, clip);
+  COGL_TRACE_BEGIN_SCOPED (ClutterStagePaintView, "Redraw (view)");
 
-  COGL_TRACE_BEGIN_SCOPED (ClutterStagePaintViewAfterPaint);
+  clutter_stage_do_paint_view (stage, view, clip);
   g_signal_emit (stage, stage_signals[AFTER_PAINT], 0);
 }
 
@@ -709,8 +705,6 @@ clutter_stage_paint (ClutterActor *self)
   ClutterActorIter iter;
   ClutterActor *child;
 
-  COGL_TRACE_BEGIN_SCOPED (ClutterStagePaint);
-
   clutter_actor_iter_init (&iter, self);
   while (clutter_actor_iter_next (&iter, &child))
     clutter_actor_paint (child);
@@ -1089,15 +1083,12 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
       CLUTTER_NOTE (ACTOR, "Recomputing layout");
 
       CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_IN_RELAYOUT);
-      COGL_TRACE_BEGIN (ClutterStageSizeNegotiation);
 
       natural_width = natural_height = 0;
       clutter_actor_get_preferred_size (CLUTTER_ACTOR (stage),
                                         NULL, NULL,
                                         &natural_width, &natural_height);
 
-      COGL_TRACE_END (ClutterStageSizeNegotiation);
-
       box.x1 = 0;
       box.y1 = 0;
       box.x2 = natural_width;
@@ -1107,13 +1098,9 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
                     (int) natural_width,
                     (int) natural_height);
 
-      COGL_TRACE_BEGIN (ClutterStageSizeAllocation);
-
       clutter_actor_allocate (CLUTTER_ACTOR (stage),
                               &box, CLUTTER_ALLOCATION_NONE);
 
-      COGL_TRACE_END (ClutterStageSizeNegotiation);
-
       CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_IN_RELAYOUT);
     }
 }
@@ -1241,22 +1228,31 @@ _clutter_stage_do_update (ClutterStage *stage)
   if (!CLUTTER_ACTOR_IS_REALIZED (stage))
     return FALSE;
 
+  COGL_TRACE_BEGIN_SCOPED (ClutterStageDoUpdate, "Update");
+
   /* NB: We need to ensure we have an up to date layout *before* we
    * check or clear the pending redraws flag since a relayout may
    * queue a redraw.
    */
+  COGL_TRACE_BEGIN (ClutterStageRelayout, "Layout");
+
   _clutter_stage_maybe_relayout (CLUTTER_ACTOR (stage));
 
+  COGL_TRACE_END (ClutterStageRelayout);
+
   if (!priv->redraw_pending)
     return FALSE;
 
   if (stage_was_relayout)
     pointers = _clutter_stage_check_updated_pointers (stage);
 
-  clutter_stage_maybe_finish_queue_redraws (stage);
+  COGL_TRACE_BEGIN (ClutterStagePaint, "Paint");
 
+  clutter_stage_maybe_finish_queue_redraws (stage);
   clutter_stage_do_redraw (stage);
 
+  COGL_TRACE_END (ClutterStagePaint);
+
   /* reset the guard, so that new redraws are possible */
   priv->redraw_pending = FALSE;
 
@@ -1270,12 +1266,16 @@ _clutter_stage_do_update (ClutterStage *stage)
     }
 #endif /* CLUTTER_ENABLE_DEBUG */
 
+  COGL_TRACE_BEGIN (ClutterStagePick, "Pick");
+
   while (pointers)
     {
       _clutter_input_device_update (pointers->data, NULL, TRUE);
       pointers = g_slist_delete_link (pointers, pointers);
     }
 
+  COGL_TRACE_END (ClutterStagePick);
+
   return TRUE;
 }
 
@@ -2965,7 +2965,7 @@ clutter_stage_read_pixels (ClutterStage *stage,
   float pixel_height;
   uint8_t *pixels;
 
-  COGL_TRACE_BEGIN_SCOPED (ClutterStageReadPixels);
+  COGL_TRACE_BEGIN_SCOPED (ClutterStageReadPixels, "Read Pixels");
 
   g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
 
diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c
index b9b22dd6f..2b20aaecb 100644
--- a/clutter/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/clutter/cogl/clutter-stage-cogl.c
@@ -933,8 +933,6 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
   gboolean swap_event = FALSE;
   GList *l;
 
-  COGL_TRACE_BEGIN (ClutterStageCoglRedraw);
-
   for (l = _clutter_stage_window_get_views (stage_window); l; l = l->next)
     {
       ClutterStageView *view = l->data;
@@ -958,8 +956,6 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
   stage_cogl->initialized_redraw_clip = FALSE;
 
   stage_cogl->frame_count++;
-
-  COGL_TRACE_END (ClutterStageCoglRedraw);
 }
 
 static void
diff --git a/cogl/cogl/cogl-trace.h b/cogl/cogl/cogl-trace.h
index 574926283..f45f53ca3 100644
--- a/cogl/cogl/cogl-trace.h
+++ b/cogl/cogl/cogl-trace.h
@@ -105,22 +105,22 @@ cogl_auto_trace_end_helper (CoglTraceHead **head)
     cogl_trace_end (*head);
 }
 
-#define COGL_TRACE_BEGIN(Name) \
+#define COGL_TRACE_BEGIN(Name, description) \
   CoglTraceHead CoglTrace##Name = { 0 }; \
   if (cogl_trace_thread_context) \
-    cogl_trace_begin (&CoglTrace##Name, #Name); \
+    cogl_trace_begin (&CoglTrace##Name, description); \
 
 #define COGL_TRACE_END(Name)\
   if (cogl_trace_thread_context) \
     cogl_trace_end (&CoglTrace##Name);
 
-#define COGL_TRACE_BEGIN_SCOPED(Name) \
+#define COGL_TRACE_BEGIN_SCOPED(Name, description) \
   CoglTraceHead CoglTrace##Name = { 0 }; \
   __attribute__((cleanup (cogl_auto_trace_end_helper))) \
     CoglTraceHead *ScopedCoglTrace##Name = NULL; \
   if (cogl_trace_thread_context) \
     { \
-      cogl_trace_begin (&CoglTrace##Name, #Name); \
+      cogl_trace_begin (&CoglTrace##Name, description); \
       ScopedCoglTrace##Name = &CoglTrace##Name; \
     }
 
@@ -128,9 +128,9 @@ cogl_auto_trace_end_helper (CoglTraceHead **head)
 
 #include <stdio.h>
 
-#define COGL_TRACE_BEGIN(Name) (void) 0
+#define COGL_TRACE_BEGIN(Name, description) (void) 0
 #define COGL_TRACE_END(Name) (void) 0
-#define COGL_TRACE_BEGIN_SCOPED(Name) (void) 0
+#define COGL_TRACE_BEGIN_SCOPED(Name, description) (void) 0
 
 void cogl_set_tracing_enabled_on_thread_with_fd (void *data, int fd);
 void cogl_set_tracing_enabled_on_thread (void *data, const char *filename);


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