This is the first article in the Perfetto series. It provides a brief introduction to the tool, including its history, development, and capabilities.
With Google announcing the deprecation of Systrace in favor of Perfetto, Perfetto has essentially replaced Systrace in my daily workflow. Major manufacturers like OPPO and vivo have also transitioned to Perfetto. Many developers new to Android performance optimization find Perfetto’s complex interface and features overwhelming, which is why I’ve decided to re-present my previous Systrace articles using Perfetto.
Table of Contents
- Perfetto Series Catalog
- Main Content
- Why Performance Analysis Needs a “God’s View”
- What is Perfetto?
- Comparison: Where Systrace Still Shines
- Reference Documents
Paul Graham once said: “Either provide something most people want a little, or something a few people want a lot.“ Perfetto is exactly what a dedicated minority “wants a lot.” Let’s begin. Please feel free to share feedback or point out errors so I can keep this as accurate as possible.
This series aims to provide a fresh perspective on Android system operation through Perfetto. It offers a unique angle to study App, Framework, and Linux internals. Even if you’ve read many articles on performance optimization, you might still feel confused because it’s hard to visualize the flow or remember the code. Through graphical tools like Perfetto, you may gain much deeper insights.
Perfetto Series Catalog
- Android Perfetto Series Catalog
- Android Perfetto Series 1: Introduction to Perfetto
- Android Perfetto Series 2: Capturing Perfetto Traces
- Android Perfetto Series 3: Familiarizing with the Perfetto View
- Android Perfetto Series 4: Opening Large Traces via Command Line
- Android Perfetto Series 5: Choreographer-based Rendering Flow
- Android Perfetto Series 6: Why 120Hz? Advantages and Challenges
- Android Perfetto Series 7: MainThread and RenderThread Deep Dive
- Android Perfetto Series 8: Understanding Vsync and Performance Analysis
- Android Perfetto Series 9: Interpreting CPU Information
- Video (Bilibili) - Android Perfetto Basics and Case Studies
Main Content
Since 2019, I’ve written over 20 articles in the Systrace series, covering everything from basic usage to module-specific analysis and real-world jank/launch optimization. These have served the needs of countless system and app developers. I’m incredibly grateful for the community support and the six discussion groups we’ve built.
However, as Google has officially deprecated Systrace in favor of Perfetto, Perfetto has become my primary tool. The industry has followed suit. For those intimidated by its complexity, this series will bridge the gap.

Why Performance Analysis Needs a “God’s View”
Android performance is influenced by a multitude of factors: app quality, system module efficiency, Linux kernel behavior, hardware constraints, vendor customizations, system load, memory pressure, thermals, and user habits. You cannot diagnose a complex issue by looking at a single app or module in isolation. You need a God’s View—a high-level, multi-dimensional perspective of the entire system.
Perfetto provides this perspective, allowing you to observe:
- The exact flow of Input events.
- How every single frame moves from app generation to screen display.
- Real-time CPU frequency, load, core migration, and wakeup sources.
- How various apps interact with system services.
By placing tracepoints at critical logic branches and enabling debug options, we can see exactly why a task was scheduled on a specific core or what blocked a thread. This initial visualization is crucial for targeted analysis.
As noted in the book Systems Performance, system engineering is challenging because the performance is subjective, complex, and often suffers from multiple concurrent issues.
Performance is Subjective
Unlike bugs that trigger clear error messages, performance is often a matter of perception. What one user considers “smooth,” another might find “laggy.”
Systems are Complex
Performance issues often arise from the intricate interconnects between sub-systems that perform well in isolation. Cascading failures—where one component’s struggle slows down others—are common. Global skill sets are often required to untangle these relationships.
Multiple Coexisting Issues
Finding one performance bottleneck often isn’t enough. In complex software, resolving one bottleneck might simply push the stress point to another part of the system. We must quantify issues—ideally using latency as the key metric—to prioritize fixes.
What is Perfetto?
Perfetto is an advanced open-source performance monitoring and analysis suite. It includes services and libraries for capturing system-wide and app-level activity, memory profiling (Native and Java), and a powerful SQL query engine for deep data analysis. Its web-based UI is capable of visualizing multi-gigabyte trace files with ease.
Google started the project in 2017. As of 2024, it has seen nearly 37,000 commits from over 100 contributors. It is a highly active, “next-generation” platform-agnostic tracing tool. It powers the tracing features in Windows Performance Tools, Android Studio, and Huawei GraphicProfiler.
If you are used to Systrace, the transition is seamless: Perfetto is fully compatible with Systrace files. You can drop a .html Systrace file into ui.perfetto.dev or convert a Perfetto trace back to the legacy Systrace UI with one click.
Core Architecture
As shown below, Perfetto consists of three main components:
- Record Traces: A rich data capture module covering Java, Native, and Linux kernel events.
- Analyze Traces: A robust analysis engine utilizing SQL queries and Metrics extraction (available via CLI for automation).
- Visualize Traces: A high-performance web UI for exploration.

Key Advantages
- Long-term Recording: Supports background recording encoded via Protobuf for efficiency.
- Full Data Spectrum: Captures Traces, Metrics, and Logs simultaneously.
- SQL Analysis: The ability to query traces using standard SQL is a game-changer. You can quantify metrics (e.g., “X metric improved by Y% after optimization”) and generate high-quality reports in minutes.
- Python API: Export data to DataFrames for scientific analysis.
- Visualization Features: Pinning critical threads, jump-to-Binder calls, wakeup source tracking, and Critical Task visualization.

Comparison: Where Systrace Still Shines (or Perfetto Differs)
Vsync-App Visualization
In Systrace, a vertical line representing Vsync-App cuts through the entire trace, making it easy to spot timing. Perfetto lacks this “global line.” However, Perfetto introduces Expected Timeline and Actual Timeline for apps.
- Expected Timeline: Represents the ideal window for the app to complete rendering.
- Actual Timeline: Shows exactly when the frame was finished and sent to SurfaceFlinger, including GPU work.
By comparing these two, you can instantly spot jank (marked in red) with much higher precision than the old Vsync lines allowed.

Screen Real Estate & Folding
Perfetto’s UI can feel “taller” and less space-efficient than Systrace. Pinning multiple threads leaves little room for the main exploration area, and unlike Systrace, some stacks don’t fold as compactly.
The Pro Solution: Use high-aspect-ratio monitors. The LG DualUp (16:18) is practically the perfect monitor for Perfetto—I’ve already convinced three colleagues to switch!

Reference Documents
- Perfetto GitHub Repository
- Official Perfetto Documentation
- Kernel Artisan: Advanced Perfetto Analysis
“If you want to go fast, go alone. If you want to go far, go together.”
