Skip to content

perfetto-cli

A CLI tool for Android Perfetto trace analysis — ANR detection, frame jank, CPU profiling, memory leak detection, binder transactions, and raw SQL queries, all from the terminal.

Features

  • ANR Detection — Detect ANR events with severity classification and multi-signal root cause analysis
  • Frame Jank Analysis — Identify janky frames (SMOOTH/JANK/BIG_JANK/HUGE_JANK) with performance ratings
  • CPU Profiling — Thread-level utilization, hotspot slices, contention analysis, DVFS frequency
  • Memory Analysis — RSS-based leak detection with growth trend, heap dominator tree
  • Binder Transactions — IPC profiling with AIDL interface and server process grouping
  • Raw SQL Queries — Execute PerfettoSQL directly, search slices by pattern
  • Trace Capture — Capture traces from device via adb with custom config
  • Multiple Output Formats — Text (Rich colorized), Table (ASCII), JSON (machine-readable)

Why perfetto-cli?

Perfetto traces contain rich performance data, but extracting insights typically requires the Perfetto UI or writing custom SQL. perfetto-cli bridges this gap by providing purpose-built commands that surface actionable insights directly in your terminal — no browser needed.

# One command to find ANR root causes
perfetto-cli -t trace.perfetto-trace -p com.example.app anr root-cause --anr-timestamp 5000

# Pipeline-friendly JSON output
perfetto-cli -t trace.perfetto-trace -p com.example.app frame jank -f json | jq '.[] | select(.severity == "HUGE_JANK")'