Profiling tools

Performance Mid-level Kotlin 2.0+ API 24+ Reviewed By Best Latest Apps

Pick the fix

You need to know why the first frame after a tap is slow on real devices. Which tool fits first?

Options
Hint 1 of 1

Which tool shows every thread over time?

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A A Perfetto system trace of a profileable release build

Correct. It shows the main thread, RenderThread, locks and Binder calls around that frame.

Why not the others?
  • B A heap dump. That's for memory, not timing.
  • C Method tracing on a debug build. Overhead hides the real timing.
  • D Logcat timestamps. Too coarse to see what blocked the frame.

30-second answer

Android Studio's profilers cover CPU (method and system traces), memory (heap dumps, allocations) and network. Perfetto system traces show every thread, frame, Binder call and lock, which is best for jank and startup. Layout Inspector shows recomposition counts. Macrobenchmark measures startup and frames in CI; Microbenchmark measures small functions. Android vitals shows real-world crashes, ANRs and slow starts.

Practise saying it · 35 s. No recording, just a timer

Match profiling tools to problems.

Say your answer out loud, then check which of these points you covered:

  • Profilers for CPU, memory, network
  • Perfetto for jank and startup
  • Layout Inspector for recomposition
  • Macrobenchmark in CI
  • Android vitals for the field

Deep dive

Profile release-like builds marked profileable, not debuggable.

Composition tracing adds composable names to Perfetto traces.

LeakCanary in debug catches memory leaks without a manual heap dump.

Firebase Performance or similar gives field traces for your own sections.

Common mistakes

  • Using method tracing to measure timing; its overhead distorts results.
  • Looking at averages instead of slow percentiles.
  • Only looking at lab data and ignoring Android vitals.

Senior take & follow-ups

Match each tool to a question you'd ask; that shows you've used them.

Follow-up questions

Think of your answer first, then open the hint.

  1. Why prefer system traces to method traces for timing?

    Show hint

    Method tracing adds heavy overhead to every call.

  2. What does profileable mean?

    Show hint

    A release build the profiler can attach to without debug overhead.

Similar on iOS: Profiling an iOS app Instruments covers the same ground on iOS.

Suggest a fix if something here is wrong or out of date.