[mutter] stack: Add some trace instrumentation
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] stack: Add some trace instrumentation
- Date: Tue, 1 Dec 2020 12:05:01 +0000 (UTC)
commit 48a90e3a8623d0ae08067f56d3ee844a77352697
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Mon Nov 30 12:06:16 2020 +0100
stack: Add some trace instrumentation
The stack and stack tracker tend to cause missed frames from time to
time, especially when there are many open windows. Add some
instrumentation to make it this easily verifiable when profiling.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1616>
src/core/stack-tracker.c | 16 ++++++++++++++++
src/core/stack.c | 4 ++++
2 files changed, 20 insertions(+)
---
diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c
index a1f8e709dc..11a1f0707c 100644
--- a/src/core/stack-tracker.c
+++ b/src/core/stack-tracker.c
@@ -1185,9 +1185,13 @@ meta_stack_tracker_restack_managed (MetaStackTracker *tracker,
int n_windows;
int old_pos, new_pos;
+ COGL_TRACE_BEGIN_SCOPED (StackTrackerRestackManaged,
+ "StackTracker: Restack Managed");
if (n_managed == 0)
return;
+ COGL_TRACE_BEGIN (StackTrackerRestackManagedGet,
+ "StackTracker: Restack Managed (get)");
meta_stack_tracker_get_stack (tracker, &windows, &n_windows);
/* If the top window has to be restacked, we don't want to move it to the very
@@ -1204,7 +1208,10 @@ meta_stack_tracker_restack_managed (MetaStackTracker *tracker,
break;
}
g_assert (old_pos >= 0);
+ COGL_TRACE_END (StackTrackerRestackManagedGet);
+ COGL_TRACE_BEGIN (StackTrackerRestackManagedRaise,
+ "StackTracker: Restack Managed (raise)");
new_pos = n_managed - 1;
if (managed[new_pos] != windows[old_pos])
{
@@ -1213,10 +1220,13 @@ meta_stack_tracker_restack_managed (MetaStackTracker *tracker,
meta_stack_tracker_get_stack (tracker, &windows, &n_windows);
/* Moving managed[new_pos] above windows[old_pos], moves the window at old_pos down by one */
}
+ COGL_TRACE_END (StackTrackerRestackManagedRaise);
old_pos--;
new_pos--;
+ COGL_TRACE_BEGIN (StackTrackerRestackManagedRestack,
+ "StackTracker: Restack Managed (restack)");
while (old_pos >= 0 && new_pos >= 0)
{
if (meta_stack_tracker_is_guard_window (tracker, windows[old_pos]))
@@ -1243,12 +1253,16 @@ meta_stack_tracker_restack_managed (MetaStackTracker *tracker,
old_pos--;
new_pos--;
}
+ COGL_TRACE_END (StackTrackerRestackManagedRestack);
+ COGL_TRACE_BEGIN (StackTrackerRestackManagedLower,
+ "StackTracker: Restack Managed (lower)");
while (new_pos > 0)
{
meta_stack_tracker_lower_below (tracker, managed[new_pos], managed[new_pos - 1]);
new_pos--;
}
+ COGL_TRACE_END (StackTrackerRestackManagedLower);
}
void
@@ -1260,6 +1274,8 @@ meta_stack_tracker_restack_at_bottom (MetaStackTracker *tracker,
int n_windows;
int pos;
+ COGL_TRACE_BEGIN_SCOPED (StackTrackerRestackAtBottom,
+ "Stack tracker: Restack at bottom");
meta_stack_tracker_get_stack (tracker, &windows, &n_windows);
for (pos = 0; pos < n_new_order; pos++)
diff --git a/src/core/stack.c b/src/core/stack.c
index 44dce70986..e1e73867da 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -78,6 +78,8 @@ on_stack_changed (MetaStack *stack)
GArray *hidden_stack_ids;
GList *sorted;
+ COGL_TRACE_BEGIN_SCOPED (StackChanged, "Stack changed");
+
meta_topic (META_DEBUG_STACK, "Syncing window stack to server");
all_root_children_stacked = g_array_new (FALSE, FALSE, sizeof (uint64_t));
@@ -259,6 +261,8 @@ meta_stack_changed (MetaStack *stack)
if (stack->freeze_count > 0)
return;
+ COGL_TRACE_BEGIN_SCOPED (MetaStackChangedSort, "Stack: Changed");
+
stack_ensure_sorted (stack);
g_signal_emit (stack, signals[CHANGED], 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]