mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
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>
This commit is contained in:
parent
c56433d6ee
commit
48a90e3a86
@ -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++)
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user