[ Web Proxy ]
URL:
Viewing: http://developer.android.com/studio/profile/sample-callstack [Back]  [Original]

Sample the callstack  |  Android Studio  |  Android Developers Skip to main content
Essentials Design & Plan Develop Google Play Blog
Search:
Android Studio
Android Developers [Android Developers]

Sample the callstack Stay organized with collections Save and categorize content based on your preferences.

Callstacks are useful for identifying CPU hot spots, or sections of code that take a long time to execute. Callstacks help you understand which part of the code has been executed, and why it was invoked.

Note: To sample the callstack, you must deploy your app to a device running Android 8.0 (API level 26) or higher.

Callstack sample overview

To sample the callstack, select the Find CPU Hotspots (Callstack Sample) task from the Android Studio Profiler Home tab. After the recording is parsed you see the following visuals:

profiler-callstack-sample.png [profiler-callstack-sample.png]

To supplement the CPU Usage and Interactions timelines, the Threads section shows frames for every call that your app and the system makes. Here are some tips for navigating the callstack sample:

profiler-callstack-frame-menu.png [profiler-callstack-frame-menu.png]

Because a Java/Kotlin program typically executes through a Java virtual machine, when Android Studio collects the callstack for a Java/Kotlin program, the callstack usually includes not just the Java/Kotlin code but also the native code required to run the program itself and for the program to talk with the system and hardware.

For information about the other visuals, see Record a system trace and the chart glossary.

Sample native code using the command line

Internally, Android Studio uses simpleperf to trace your app's native code. If you want to specify additional options for Simpleperf, such as sampling specific device CPUs or specifying sampling durations at a high accuracy, you can use simpleperf from the command line.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-03-06 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-03-06 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page