בדיקת הביצועים
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
כדאי לבדוק את הביצועים כדי להבין מה קורה באפליקציה ולוודא שהיא עומדת בציפיות שלכם.
ב-Android יש כמה כלים שבהם אפשר להשתמש כדי לבדוק את הביצועים של האפליקציה.
כשמתחילים, מומלץ להתמקד באזור אחד בכל פעם במהלך הבדיקה. האזורים האלה יכולים לכלול:
- הפעלת האפליקציה
- רינדור איטי (jank)
- מעברים בין מסכים ואירועי ניווט
- עבודה ממושכת
- פעולות ברקע, כמו קלט/פלט ופעולות ברשת
לחלופין, אפשר לבדוק את תהליכי העבודה של האפליקציה שקריטיים למשתמשים.
כך תוכלו לקבל תמונה מלאה של המקומות שבהם הביצועים לא עומדים בציפיות.
יש שתי גישות עיקריות לבדיקת הביצועים: ידנית ואוטומטית.
סביר להניח שתתחילו בניפוי באגים ידני כשבודקים אזור חדש.
בדיקה ידנית
אחרי שמחליטים איזו נקודה באפליקציה רוצים לבדוק, אפשר להשתמש במגוון כלים כדי לזהות בדיוק מה קורה.
הכלי המקיף ביותר לבדיקת הביצועים במכשירים עם Android מגרסה 9 ואילך הוא Perfetto. Perfetto מספק את רמת הפירוט הגבוהה ביותר של מידע המעקב. באמצעות מסננים מתקדמים, אתם יכולים להתאים את רמת הפירוט לצרכים שלכם. מידע נוסף על צילום עקבות ממכשירי Android זמין במדריך התחלה מהירה: הקלטת עקבות ב-Android.
כלי הפרופילים של Android שמוטמעים ב-Android Studio יכולים גם לספק תובנות חשובות לגבי הביצועים של האפליקציה. אפשר להגביל את רמת הפירוט לאפליקציה, או כשמריצים את האפליקציה במכשירים עם גרסה קודמת ל-Android 9.
מידע נוסף זמין במאמר סקירה כללית של מעקב אחר המערכת או בסדרת הסרטונים המפורטת בנושא ניפוי באגים בביצועים.
בדיקות אוטומטיות
בנוסף לבדיקה ידנית, אפשר להגדיר בדיקות אוטומטיות כדי לאסוף ולצבור נתוני ביצועים. כך תוכלו להבין מה המשתמשים רואים בפועל ולזהות מקרים של רגרסיות. מידע נוסף על הגדרת בדיקות ביצועים אוטומטיות לאפליקציה זמין במאמר השוואת האפליקציה לביצועים של אפליקציות אחרות.
יש כמה כלים שבהם אפשר להשתמש כדי לבדוק את הביצועים ולעקוב אחריהם, וכך לשפר את האפליקציה.
הסבר על ספריות ההשוואה לשוק כדי להבין את הביצועים ברמה המקומית
- ספריית Macrobenchmark עוזרת למדוד אינטראקציות גדולות יותר של משתמשי קצה, כמו הפעלה, אינטראקציה עם ממשק המשתמש ואנימציות.
- ספריית המיקרו-בנצ'מרק עוזרת לנתח את הביצועים במצבים ספציפיים לאפליקציה, ברמת פירוט גבוהה יותר.
הסבר על הביצועים בסביבת הייצור
- התכונה תפקוד האפליקציה יכולה לעזור לכם לשפר את הביצועים של האפליקציה. היא מתריעה לכם כשערכים שונים של מדדי ביצועים חורגים מספים שנקבעו מראש.
- Firebase performance SDK אוסף מדדים שונים לגבי הביצועים של האפליקציה. לדוגמה, אפשר להשתמש ב-SDK כדי למדוד את הזמן שחלף בין הרגע שבו המשתמש פותח את האפליקציה לבין הרגע שבו האפליקציה מתחילה להגיב, וכך לזהות צווארי בקבוק פוטנציאליים בהפעלה.
יצירת פרופיל באופן מקומי באמצעות Android Studio
- אפשר להשתמש ב-Android Studio כדי להקליט ולהציג עקבות של המערכת או עקבות של דגימת מחסנית.
- הקלטת נתוני מעקב באמצעות Android Studio. מידע נוסף זמין בסדרת הסרטונים בנושא ניפוי באגים בביצועים.
- אפשר להשתמש ב-Simpleperf, כלי מובנה לדגימת מחסנית ל-Android, כדי ליצור פרופיל של אפליקציות ל-Android ושל תהליכים מובנים שפועלים ב-Android. הוא יכול ליצור פרופיל של קוד Java וקוד C++ ב-Android.
כלים מתקדמים ליצירת פרופילים: Perfetto tracing
מקורות מידע נוספים
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 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)"]]