Memeriksa performa
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Memeriksa performa dapat membantu Anda memahami apa yang terjadi dalam aplikasi dan
memastikannya memenuhi harapan Anda.
Android menyediakan beberapa alat yang dapat Anda gunakan untuk memeriksa performa aplikasi.
Saat memulai, sebaiknya Anda berfokus pada area satu per satu selama
pemeriksaan. Area ini dapat mencakup beberapa hal berikut:
- Peluncuran Aplikasi
- Rendering lambat (jank)
- Transisi layar dan peristiwa navigasi
- Pekerjaan yang berjalan lama
- Operasi di latar belakang, seperti I/O dan jaringan
Atau, Anda dapat memeriksa perjalanan penting pengguna dalam alur kerja aplikasi Anda.
Hal ini dapat membantu Anda mendapatkan pemahaman holistik tentang performa dan
ekspektasi yang tidak selaras.
Ada dua pendekatan utama saat memeriksa performa, manual dan otomatis.
Sepertinya Anda akan memulai proses debug manual saat memeriksa area baru.
Pemeriksaan manual
Setelah menentukan area aplikasi yang akan diperiksa, Anda
dapat menggunakan berbagai alat untuk mengidentifikasi hal yang sebenarnya terjadi.
Alat paling komprehensif untuk memeriksa performa pada perangkat yang menjalankan Android 9
dan yang lebih tinggi adalah Perfetto. Perfetto memberikan detail
pelacakan informasi yang semaksimal mungkin. Dengan filter yang canggih, Anda dapat menyesuaikan
tingkat detail sesuai kebutuhan. Untuk mengetahui informasi selengkapnya tentang cara mengambil rekaman aktivitas
dari perangkat Android, lihat Panduan memulai: Merekam aktivitas di
Android.
Android profiler yang terintegrasi di Android Studio juga dapat memberikan insight
penting tentang performa aplikasi, tempat Anda dapat membatasi tingkat detail untuk
aplikasi, atau saat beroperasi di perangkat yang lebih lama dari Android
9.
Untuk mengetahui informasi selengkapnya, lihat Ringkasan pelacakan sistem atau tonton rangkaian
pembahasan mendalam tentang proses debug performa.
Pengujian otomatis
Selain pemeriksaan manual, Anda dapat menyiapkan pengujian otomatis untuk mengumpulkan dan
menggabungkan data performa. Pengujian otomatis ini membantu Anda memahami hal yang
sebenarnya dilihat pengguna dan melakukan identifikasi saat terjadi regresi. Untuk mengetahui informasi selengkapnya tentang
menyiapkan pengujian performa otomatis untuk aplikasi, lihat Menjalankan benchmark aplikasi
Anda.
Ada beberapa alat yang dapat Anda gunakan untuk memeriksa dan memantau performa guna membantu
meningkatkan kualitas aplikasi.
Memahami performa secara lokal dengan library Benchmark
- Library Macrobenchmark membantu Anda mengukur interaksi pengguna akhir
yang lebih besar, seperti startup, interaksi dengan UI, dan animasi.
- Library Microbenchmark membantu menganalisis performa situasi khusus aplikasi
yang lebih terperinci.
Memahami performa dalam produksi
- Android vitals dapat membantu meningkatkan performa aplikasi Anda dengan memberi tahu Anda
saat berbagai metrik performa melebihi nilai minimum yang telah ditentukan.
- Firebase performance SDK mengumpulkan berbagai metrik tentang performa
aplikasi Anda. Misalnya, Anda dapat menggunakan SDK untuk mengukur waktu antara
saat pengguna membuka aplikasi hingga aplikasi mulai merespons, yang membantu
mengidentifikasi potensi bottleneck peluncuran.
Membuat profil secara lokal dengan Android Studio
- Gunakan Android Studio untuk merekam dan melihat pelacakan sistem atau pelacakan pengambilan sampel
stack.
- Rekam aktivitas menggunakan Android Studio. Untuk mengetahui informasi selengkapnya, lihat
serial video Proses Debug Performa.
- Gunakan Simpleperf, alat pengambilan sampel stack native untuk Android, untuk membuat profil
aplikasi Android dan proses native yang berjalan di Android. Dapat membuat profil
kode Java dan C++ di Android.
Alat pembuatan profil lanjutan: Pelacakan Perfetto
Referensi lainnya
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-27 UTC."],[],[],null,["# Inspect performance to help you understand what is happening in your app and\nensure it meets your expectations.\n\nAndroid provides several tools you can use to inspect your app's performance.\nWhen getting started, we recommend you focus on one area at a time during\ninspection. These areas can include the following:\n\n- App startup\n- Slow rendering (jank)\n- Screen transitions and navigation events\n- Long running work\n- Operations in the background, such as I/O and networking\n\nAlternatively, you can inspect critical user journeys of your app's workflow.\nThis can help you gain a holistic understanding of where performance and\nexpectations don't align.\n\nThere are two main approaches when inspecting performance, manual and automated.\nIt's likely that you start with manual debugging when inspecting a new area.\n\nManual inspection\n-----------------\n\nAfter deciding which area of your app to inspect, you can use a variety of tools\nto identify what exactly is happening.\n\nThe most comprehensive tool to inspect performance on devices running Android 9\nand higher is [Perfetto](https://perfetto.dev/). Perfetto provides the highest possible\ndetail of tracing information. By using powerful filters, you can adjust the\nlevel of detail for your needs. For more information about how to capture traces\nfrom Android devices, see the [Quickstart: Record traces on\nAndroid](https://perfetto.dev/docs/quickstart/android-tracing) guide.\n\nThe [Android profilers](/studio/profile) built into Android Studio can also provide valuable\ninsights into your app's performance, where you can limit the level of detail to\nyour app, or when running on devices earlier than Android\n9.\n\nFor more information, see [Overview of system tracing](/topic/performance/tracing) or watch the in-depth\nseries on [performance debugging](https://www.youtube.com/playlist?list=PLWz5rJ2EKKc-xjSI-rWn9SViXivBhQUnp).\n\nAutomated testing\n-----------------\n\nIn addition to manual inspection, you can set up automated tests to collect and\naggregate performance data. This helps you understand what users are actually\nseeing and identify when regressions might occur. For more information about\nsetting up automated performance tests for your app, see [Benchmark your\napp](/topic/performance/benchmarking/benchmarking-overview).\n\nApp startup performance\n-----------------------\n\nThere are multiple tools you can use to inspect and monitor performance to help\nimprove your app.\n\n### Understand performance locally with Benchmark libraries\n\n- The [Macrobenchmark library](/topic/performance/benchmarking/macrobenchmark-overview) helps you measure larger end-user interactions, such as startup, interacting with the UI, and animations.\n- The [Microbenchmark library](/topic/performance/benchmarking/microbenchmark-overview) helps analyze performance of more granular, app-specific situations.\n\n### Understand performance in production\n\n- [Android vitals](/topic/performance/vitals) can help improve your app's performance by alerting you when various performance metrics exceed predetermined thresholds.\n- The [Firebase performance SDK](https://firebase.google.com/docs/perf-mon/get-started-android) collects various metrics about your app's performance. For example, you can use the SDK to measure the time between when the user opens the app and when the app becomes responsive, helping identify potential startup bottlenecks.\n\n### Profile locally with Android Studio\n\n- Use [Android Studio](/studio/profile) to record and view system traces or stack sampling traces.\n- [Record traces](/studio/profile/record-traces) using Android Studio. For additional information, see the [Performance Debugging video series](https://www.youtube.com/playlist?list=PLWz5rJ2EKKc-xjSI-rWn9SViXivBhQUnp).\n- Use [Simpleperf](https://android.googlesource.com/platform/system/extras/+/master/simpleperf/doc/README.md), a native stack sampling tool for Android, to profile both Android apps and native processes running on Android. It can profile both Java and C++ code on Android.\n\n### Advanced profiling tools: Perfetto tracing\n\n- [Perfetto](https://perfetto.dev/): a platform-wide tracing tool available on Android 10 (API level 29) and higher. For more information, see the [overview of Perfetto traces](https://perfetto.dev/docs/).\n- [Run Perfetto using `adb`](/studio/command-line/perfetto): describes how to run the `perfetto` command-line tool to capture traces.\n- [Recording a trace through the cmdline](https://perfetto.dev/docs/quickstart/android-tracing#recording-a-trace-through-the-cmdline): describes how to build and run the `perfetto` command-line tool to capture traces.\n- [Perfetto web-based trace viewer](https://perfetto.dev/docs/quickstart/android-tracing#recording-a-trace-through-the-perfetto-ui): opens Perfetto traces and displays a complete report. You can also open [Systrace](/topic/performance/tracing) traces in this viewer using the legacy UI option.\n\nAdditional resources\n--------------------\n\n- [Performance debugging - MAD skills series](https://www.youtube.com/playlist?list=PLWz5rJ2EKKc-xjSI-rWn9SViXivBhQUnp)\n- [Profile your app performance](/studio/profile)\n- [Write a Macrobenchmark](/topic/performance/benchmarking/macrobenchmark-overview)\n- [Microbenchmark](/topic/performance/benchmarking/microbenchmark-overview)"]]