ANR Detection¶
Detect ANR (Application Not Responding) events and identify root causes through multi-signal analysis.
Overview¶
ANR occurs when an application's main thread is blocked for too long (typically 5+ seconds). perfetto-cli detects ANR events from Perfetto traces and classifies their severity.
Commands¶
anr detect¶
Detect ANR events with severity classification.
Options:
| Option | Description | Default |
|---|---|---|
--min-duration <ms> |
Minimum ANR duration to report | None |
Example output:
ANR Events (2 found)
┌──────────┬──────────┬──────────────┬──────────┐
│ Time │ Duration │ Thread │ Severity │
├──────────┼──────────┼──────────────┼──────────┤
│ 5.234s │ 6.1s │ main │ CRITICAL │
│ 12.001s │ 5.3s │ main │ HIGH │
└──────────┴──────────┴──────────────┴──────────┘
anr root-cause¶
Multi-signal root cause analysis. Correlates ANR events with CPU, lock contention, binder, and I/O signals to identify the most likely cause.
Options:
| Option | Description | Required |
|---|---|---|
--anr-timestamp <ms> |
Timestamp of the ANR event to analyze | Yes |
Workflow¶
- Run
anr detectto find ANR events and their timestamps - Pick a specific ANR timestamp
- Run
anr root-cause --anr-timestamp <ts>for detailed root cause analysis
Tips¶
- Use
--min-durationto filter out borderline cases and focus on severe ANRs - Combine with
cpu contentionto see if lock contention contributed to the ANR - Use
-f jsonto integrate ANR detection into CI pipelines