Using a Trace

Once a trace is captured and understood, it can be used to investigate concrete issues. This page describes a method to analyze UI performance and the common patterns to look out for.

UI Performance

Method

To investigate UI performance, proceed as follows:

  1. Examine the Scheduler graph: identify tasks or threads that execute frequently but serve no useful purpose.

  2. Analyze the Frames graph: look for irregularities in the FPS. When an inconsistency is detected, zoom in to examine what is being drawn and where, distinguishing between software and GPU drawings and their destinations.

  3. Investigate the Tasks and Threads graph: distinguish activities surrounding the drawings, such as computing layouts or rendering specific widgets.

  4. Correlate the Frames and Tasks/Threads views: check whether the same patterns were executed multiple times for a single frame. This may indicate that the content was rendered more than once for a single flush.

Common Patterns

Rendering without flushing

When the same content is drawn several times before a single flush, the display is rendered more than necessary, wasting CPU and GPU time. Correlate the Frames and Tasks/Threads views to spot a pattern that repeats within a single frame.

Frames and UIPump tracks showing frame 17 rendered twice for a single flush

Frame 17 renders its content twice before a single flush.

In the image above, frame 17 is noticeably long: its frame rate is lower than the frames around it, with frames 15 and 16 reaching roughly twice its FPS. The [MEJ] UIPump track shows the same render pattern (MWT_Render SwipeContainer_2 and its children) executed twice within this single frame, with no flush in between. The content is therefore drawn twice but flushed only once, doubling the work for a single displayed frame.

Clear Screen Pattern

A common performance issue is the excessive number of “clear screen” operations (filling the entire screen with a rectangle) before drawing widget contents. This is frequently linked to the stacking of MWT backgrounds such as RectangularBackground.

To pinpoint this pattern:

  • Open the Traces process and look for UI_FillRectangle.

  • Alternatively, press Ctrl+F anywhere on the graph and search for UI_FillRectangle, UI_FillRoundedRectangle, or UI_DrawImage. All other traces will be grayed out.

Ctrl+F search highlighting UI_FillRectangle events

Using Ctrl+F to highlight UI_FillRectangle events across the trace.

The matched events reveal where the screen is repeatedly cleared.

A matched UI_FillRectangle selected in the graph

Two UI_FillRectangle operations clear the entire screen one after the other; one of them is redundant and can be removed.

Warning

The traces UI_FillRectangle, UI_FillRoundedRectangle, and UI_DrawImage indicate in their summary both the drawing parameters and the drawn region. The drawn region may be smaller than the specified parameters when a clip is active.

Summary panel showing drawing parameters versus drawn region

Selecting a UI_FillRectangle matched by the search shows, in its Summary, the drawing parameters and the drawn region.