Glance Rishi Jun 1, 2023

Testing Android UI Performance Part 2

Article Summary

You found the jank in your Android app. Now what? Most teams stop at identifying the problem—but that's only half the battle.

In Part 2 of Glance's performance testing series, engineer Rishi dives into the diagnostic tools that pinpoint exactly where UI jank originates. This guide moves beyond detection into root cause analysis using Systrace, Perfetto, and custom trace events.

Key Takeaways

Critical Insight

Combining Systrace's visual timeline with Perfetto's SQL querying turns performance debugging from guesswork into a systematic, automatable process.

The article hints at CPU profiler techniques coming in Part 3 for when trace analysis still doesn't reveal enough detail.

About This Article

Problem

When Android apps have UI jank, teams find it hard to track down which code is causing frame delays. The problem gets worse across multiple threads and processes, and there aren't good tools to help diagnose it systematically.

Solution

Rishi uses Systrace to visualize frame rendering with color-coded timelines. He adds custom Trace.beginSection() events to find slow methods. Then he uses Perfetto's SQL Trace Processor to query event durations and compare them against performance benchmarks.

Impact

This approach works in CI/CD pipelines. Developers can commit code, run UI tests with Perfetto capture, and get automatic alerts when custom event durations go over the established benchmarks. Regressions get caught before the code reaches production.