Skip to content

CPU Profiling

Thread-level CPU utilization analysis, hotspot detection, and contention analysis.

Overview

CPU analysis helps identify which threads are consuming resources, what code is running during performance-critical sections, and where thread contention is causing delays.

Commands

cpu utilization

Per-thread CPU utilization breakdown.

perfetto-cli -t trace.perfetto-trace -p com.example.app cpu utilization

Options:

Option Description Default
--include-frequency Include CPU frequency (DVFS) information Off

cpu hotspots

Identify the top time-consuming slices on the main thread.

perfetto-cli -t trace.perfetto-trace -p com.example.app cpu hotspots

Options:

Option Description Default
--limit <n> Maximum number of hotspot slices to show 20

cpu contention

Analyze thread contention β€” lock waits and scheduling delays.

perfetto-cli -t trace.perfetto-trace -p com.example.app cpu contention

Workflow

  1. Run cpu utilization to see which threads are busy
  2. Run cpu hotspots to find the most expensive operations on the main thread
  3. If you see scheduling delays, run cpu contention to identify lock holders

Tips

  • Use --include-frequency to check if CPU throttling is affecting performance
  • Hotspots are sorted by total duration β€” look for unexpected entries
  • Contention analysis reveals deadlock-prone patterns