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.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
This commit is contained in:
Georges Basile Stavracas Neto 2019-04-12 17:19:31 -03:00
parent e741cab3f4
commit 9b8f9b65b8
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385
3 changed files with 27 additions and 17 deletions

View File

@ -633,8 +633,6 @@ clutter_stage_do_paint_view (ClutterStage *stage,
float viewport[4]; float viewport[4];
cairo_rectangle_int_t geom; cairo_rectangle_int_t geom;
COGL_TRACE_BEGIN_SCOPED (ClutterStageDoPaintView);
_clutter_stage_window_get_geometry (priv->impl, &geom); _clutter_stage_window_get_geometry (priv->impl, &geom);
viewport[0] = priv->viewport[0]; viewport[0] = priv->viewport[0];
@ -688,14 +686,12 @@ _clutter_stage_paint_view (ClutterStage *stage,
{ {
ClutterStagePrivate *priv = stage->priv; ClutterStagePrivate *priv = stage->priv;
COGL_TRACE_BEGIN_SCOPED (ClutterStagePaintView);
if (!priv->impl) if (!priv->impl)
return; return;
clutter_stage_do_paint_view (stage, view, clip); COGL_TRACE_BEGIN_SCOPED (ClutterStagePaintView, "Paint (view)");
COGL_TRACE_BEGIN_SCOPED (ClutterStagePaintViewAfterPaint); clutter_stage_do_paint_view (stage, view, clip);
g_signal_emit (stage, stage_signals[AFTER_PAINT], 0); g_signal_emit (stage, stage_signals[AFTER_PAINT], 0);
} }
@ -709,8 +705,6 @@ clutter_stage_paint (ClutterActor *self)
ClutterActorIter iter; ClutterActorIter iter;
ClutterActor *child; ClutterActor *child;
COGL_TRACE_BEGIN_SCOPED (ClutterStagePaint);
clutter_actor_iter_init (&iter, self); clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child)) while (clutter_actor_iter_next (&iter, &child))
clutter_actor_paint (child); clutter_actor_paint (child);
@ -1234,22 +1228,31 @@ _clutter_stage_do_update (ClutterStage *stage)
if (!CLUTTER_ACTOR_IS_REALIZED (stage)) if (!CLUTTER_ACTOR_IS_REALIZED (stage))
return FALSE; return FALSE;
COGL_TRACE_BEGIN_SCOPED (ClutterStageDoUpdate, "Update");
/* NB: We need to ensure we have an up to date layout *before* we /* 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 * check or clear the pending redraws flag since a relayout may
* queue a redraw. * queue a redraw.
*/ */
COGL_TRACE_BEGIN (ClutterStageRelayout, "Layout");
_clutter_stage_maybe_relayout (CLUTTER_ACTOR (stage)); _clutter_stage_maybe_relayout (CLUTTER_ACTOR (stage));
COGL_TRACE_END (ClutterStageRelayout);
if (!priv->redraw_pending) if (!priv->redraw_pending)
return FALSE; return FALSE;
if (stage_was_relayout) if (stage_was_relayout)
pointers = _clutter_stage_check_updated_pointers (stage); 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); clutter_stage_do_redraw (stage);
COGL_TRACE_END (ClutterStagePaint);
/* reset the guard, so that new redraws are possible */ /* reset the guard, so that new redraws are possible */
priv->redraw_pending = FALSE; priv->redraw_pending = FALSE;
@ -1263,12 +1266,16 @@ _clutter_stage_do_update (ClutterStage *stage)
} }
#endif /* CLUTTER_ENABLE_DEBUG */ #endif /* CLUTTER_ENABLE_DEBUG */
COGL_TRACE_BEGIN (ClutterStagePick, "Pick");
while (pointers) while (pointers)
{ {
_clutter_input_device_update (pointers->data, NULL, TRUE); _clutter_input_device_update (pointers->data, NULL, TRUE);
pointers = g_slist_delete_link (pointers, pointers); pointers = g_slist_delete_link (pointers, pointers);
} }
COGL_TRACE_END (ClutterStagePick);
return TRUE; return TRUE;
} }
@ -2954,7 +2961,7 @@ clutter_stage_read_pixels (ClutterStage *stage,
float pixel_height; float pixel_height;
uint8_t *pixels; 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); g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);

View File

@ -936,6 +936,9 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
if (do_swap_buffer) if (do_swap_buffer)
{ {
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
"Paint (swap framebuffer)");
if (clutter_stage_view_get_onscreen (view) != if (clutter_stage_view_get_onscreen (view) !=
clutter_stage_view_get_framebuffer (view)) clutter_stage_view_get_framebuffer (view))
{ {
@ -960,7 +963,7 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
gboolean swap_event = FALSE; gboolean swap_event = FALSE;
GList *l; GList *l;
COGL_TRACE_BEGIN (ClutterStageCoglRedraw); COGL_TRACE_BEGIN (ClutterStageCoglRedraw, "Paint (Cogl Redraw)");
for (l = _clutter_stage_window_get_views (stage_window); l; l = l->next) for (l = _clutter_stage_window_get_views (stage_window); l; l = l->next)
{ {

View File

@ -105,22 +105,22 @@ cogl_auto_trace_end_helper (CoglTraceHead **head)
cogl_trace_end (*head); cogl_trace_end (*head);
} }
#define COGL_TRACE_BEGIN(Name) \ #define COGL_TRACE_BEGIN(Name, description) \
CoglTraceHead CoglTrace##Name = { 0 }; \ CoglTraceHead CoglTrace##Name = { 0 }; \
if (g_private_get (&cogl_trace_thread_data)) \ if (g_private_get (&cogl_trace_thread_data)) \
cogl_trace_begin (&CoglTrace##Name, #Name); \ cogl_trace_begin (&CoglTrace##Name, description); \
#define COGL_TRACE_END(Name)\ #define COGL_TRACE_END(Name)\
if (g_private_get (&cogl_trace_thread_data)) \ if (g_private_get (&cogl_trace_thread_data)) \
cogl_trace_end (&CoglTrace##Name); cogl_trace_end (&CoglTrace##Name);
#define COGL_TRACE_BEGIN_SCOPED(Name) \ #define COGL_TRACE_BEGIN_SCOPED(Name, description) \
CoglTraceHead CoglTrace##Name = { 0 }; \ CoglTraceHead CoglTrace##Name = { 0 }; \
__attribute__((cleanup (cogl_auto_trace_end_helper))) \ __attribute__((cleanup (cogl_auto_trace_end_helper))) \
CoglTraceHead *ScopedCoglTrace##Name = NULL; \ CoglTraceHead *ScopedCoglTrace##Name = NULL; \
if (g_private_get (&cogl_trace_thread_data)) \ if (g_private_get (&cogl_trace_thread_data)) \
{ \ { \
cogl_trace_begin (&CoglTrace##Name, #Name); \ cogl_trace_begin (&CoglTrace##Name, description); \
ScopedCoglTrace##Name = &CoglTrace##Name; \ ScopedCoglTrace##Name = &CoglTrace##Name; \
} }
@ -128,9 +128,9 @@ cogl_auto_trace_end_helper (CoglTraceHead **head)
#include <stdio.h> #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_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, void cogl_set_tracing_enabled_on_thread_with_fd (void *data,
int fd); int fd);