Esaminare il rendimento
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Esamina le prestazioni per capire cosa succede nella tua app e
assicurati che soddisfi le tue aspettative.
Android offre diversi strumenti che puoi utilizzare per esaminare le prestazioni della tua app.
All'inizio, ti consigliamo di concentrarti su un'area alla volta durante l'ispezione. Queste aree possono includere:
- Avvio dell'app
- Rendering lento (jank)
- Transizioni dello schermo ed eventi di navigazione
- Lavoro a lungo termine
- Operazioni in background, come I/O e networking
In alternativa, puoi esaminare i percorsi degli utenti critici del flusso di lavoro della tua app.
Questo può aiutarti ad acquisire una comprensione olistica dei punti in cui le prestazioni e le aspettative non si allineano.
Esistono due approcci principali per l'analisi del rendimento: manuale e automatico.
È probabile che tu abbia iniziato con il debug manuale durante l'ispezione di una nuova area.
Ispezione manuale
Dopo aver deciso quale area della tua app esaminare, puoi utilizzare una serie di strumenti per identificare cosa sta succedendo esattamente.
Lo strumento più completo per esaminare le prestazioni sui dispositivi con Android 9 e versioni successive è Perfetto. Perfetto fornisce il massimo dettaglio
possibile delle informazioni di tracciamento. Grazie a filtri efficaci, puoi regolare
il livello di dettaglio in base alle tue esigenze. Per ulteriori informazioni su come acquisire tracce da dispositivi Android, consulta la Guida rapida: registrazione di tracce su Android.
I profiler Android integrati in Android Studio possono inoltre fornire preziose informazioni
sul rendimento della tua app, dove puoi limitare il livello di dettaglio
della tua app o quando l'app viene eseguita su dispositivi precedenti ad Android
9.
Per ulteriori informazioni, consulta la Panoramica sul tracciamento del sistema o guarda la serie approfondita sul debug delle prestazioni.
Test automatici
Oltre all'ispezione manuale, puoi configurare test automatici per raccogliere e
aggregare i dati sul rendimento. Questo ti aiuta a capire cosa vedono effettivamente
gli utenti e a identificare quando potrebbero verificarsi regressioni. Per ulteriori informazioni sulla configurazione dei test automatici del rendimento della tua app, consulta la pagina Benchmark della tua app.
Esistono diversi strumenti che puoi utilizzare per ispezionare e monitorare le prestazioni e migliorare la tua app.
Comprendi il rendimento a livello locale con le librerie di benchmark
- La libreria Macrobenchmark consente di misurare interazioni più ampie dell'utente finale, come l'avvio, l'interazione con l'interfaccia utente e le animazioni.
- La libreria Microbenchmark consente di analizzare le prestazioni di situazioni più granulari e specifiche dell'app.
Informazioni sul rendimento in produzione
- Android vitals può contribuire a migliorare le prestazioni della tua app avvisandoti quando varie metriche sulle prestazioni superano le soglie predeterminate.
- L'SDK Firebase Performance raccoglie varie metriche relative alle prestazioni della tua app. Ad esempio, puoi utilizzare l'SDK per misurare il tempo che intercorre tra l'apertura dell'app da parte dell'utente e il momento in cui quest'ultima diventa reattiva, in modo da identificare potenziali colli di bottiglia nell'avvio.
Profila localmente con Android Studio
- Utilizza Android Studio per registrare e visualizzare le analisi di sistema o di campionamento dello stack.
- Registra le tracce con Android Studio. Per ulteriori informazioni, consulta la serie di video sul debug del rendimento.
- Utilizza Simpleperf, uno strumento nativo di campionamento dello stack per Android, per profilare sia le app per Android sia i processi nativi in esecuzione su Android. Può profilare sia il codice Java che C++ su Android.
Strumenti di profilazione avanzati: tracciamento Perfetto
Risorse aggiuntive
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2025-07-27 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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)"]]