با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
ضبط فعالیت دستگاه در مدت زمان کوتاه به عنوان ردیابی سیستم شناخته می شود. ردیابی سیستم یک فایل ردیابی تولید می کند که می توانید از آن برای تولید گزارش سیستم استفاده کنید. این گزارش به شما کمک می کند تا بهترین راه را برای بهبود عملکرد برنامه یا بازی خود شناسایی کنید.
برای آشنایی کامل با ردیابی و پروفایل، به صفحه Tracing 101 در مستندات Perfetto مراجعه کنید.
پلتفرم اندروید چندین گزینه مختلف برای گرفتن ردیابی ارائه می دهد:
CPU Android Studio و پروفایلر حافظه
ابزار خط فرمان Perfetto (اندروید 10 و بالاتر)
ابزار ردیابی سیستم
ابزار خط فرمان Systrace
نمایه ساز CPU Android Studio میزان استفاده از CPU و فعالیت رشته برنامه شما را در زمان تعامل با برنامه خود به طور همزمان بررسی می کند. همچنین میتوانید جزئیات را در ردیابیهای روش ثبتشده، ردیابی عملکرد و ردیابی سیستم بررسی کنید. نمایه ساز حافظه یک نمای کلی از استفاده از حافظه در رابطه با رویدادهای لمسی، تغییرات Activity ، و رویدادهای جمع آوری زباله ارائه می دهد.
Perfetto ابزار ردیابی گسترده پلتفرم است که در اندروید 10 معرفی شده است. این یک پروژه ردیابی متن باز پیچیده برای اندروید، لینوکس و کروم است. این مجموعه ابرمجموعه ای از منابع داده را در مقایسه با Systrace ارائه می دهد و به شما امکان می دهد ردهای دلخواه طولانی را در یک جریان بافر پروتکل باینری ضبط کنید. میتوانید این ردیابیها را در Perfetto UI باز کنید.
ابزار System Tracing یک ابزار اندرویدی است که فعالیت دستگاه را در یک فایل ردیابی ذخیره می کند. در دستگاهی که دارای Android 10 (سطح API 29) یا بالاتر است، فایلهای ردیابی در قالب Perfetto ذخیره میشوند، همانطور که در ادامه این سند نشان داده شده است. در دستگاهی که دارای نسخه قبلی اندروید است، فایلهای ردیابی در قالب Systrace ذخیره میشوند.
Systrace یک ابزار خط فرمان قدیمی ارائه شده توسط پلتفرم است که فعالیت دستگاه را در مدت زمان کوتاهی در یک فایل متنی فشرده ثبت می کند. این ابزار گزارشی را تولید میکند که دادههای هسته اندروید را ترکیب میکند، مانند زمانبندی CPU، فعالیت دیسک، و رشتههای برنامه. Systrace روی همه نسخههای پلتفرم اندروید کار میکند، اما ما Perfetto را برای دستگاههای دارای Android 10 و بالاتر توصیه میکنیم.
شکل 1. نمونه نمای Perfetto Trace، که حدود 20 ثانیه تعامل با یک برنامه را نشان می دهد.
شکل 2. یک نمونه گزارش Systrace HTML، که پنج ثانیه تعامل با یک برنامه را نشان می دهد.
هر دو گزارش تصویری کلی از فرآیندهای سیستم یک دستگاه مجهز به اندروید برای یک دوره زمانی معین ارائه می دهند. این گزارش همچنین اطلاعات ردیابی گرفته شده را بررسی میکند تا مشکلاتی را که مشاهده میکند، مانند جابجایی UI یا مصرف انرژی بالا، برجسته کند.
Perfetto و Systrace قابل همکاری هستند:
فایل های Perfetto و Systrace را در Perfetto UI باز کنید. با کلیک روی پیوند Open with legacy UI فایل های Systrace را با نمایشگر قدیمی Systrace در Perfetto UI باز کنید.
نمایشگر ردیابی مبتنی بر وب Perfetto Traces Perfetto را باز می کند و یک گزارش کامل را نمایش می دهد. همچنین می توانید با استفاده از گزینه legacy UI Traces Systrace را در این نمایشگر باز کنید.
توضیح میدهد که چگونه میتوانید برچسبهای سفارشی را به بخشهای خاصی از کد خود اعمال کنید، که امکان تجزیه و تحلیل ریشهای آسانتر را در Systrace یا Perfetto فراهم میکند.
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-08-27 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-08-27 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Overview of system tracing\n\nRecording device activity over a short period of time is known as *system\ntracing*. System tracing produces a trace file that you can use to generate a\nsystem report. This report helps you identify how best to improve your app or\ngame's performance.\n\nFor a comprehensive introduction to tracing and profiling, see the\n[Tracing 101](https://perfetto.dev/docs/tracing-101) page in the\nPerfetto documentation.\n\nThe Android platform provides several different options for capturing traces:\n\n- Android Studio CPU and memory profiler\n- Perfetto command-line tool (Android 10 and higher)\n- System tracing utility\n- Systrace command-line tool\n\nThe Android Studio CPU profiler inspects your app's CPU usage and thread\nactivity in real time while you interact with your app. You can also inspect the\ndetails in recorded method traces, function traces, and system traces. The\nmemory profiler gives an overview of memory usage in relation to touch events,\n[`Activity`](/reference/android/app/Activity) changes, and garbage collection\nevents.\n\nPerfetto is the platform-wide tracing tool introduced in\nAndroid 10. It is a sophisticated open source tracing project for\nAndroid, Linux, and Chrome. It offers a superset of data sources compared to\nSystrace and lets you record arbitrarily long traces in a protocol buffer binary\nstream. You can open these traces in the [Perfetto\nUI](https://ui.perfetto.dev/#!/).\n\nThe System tracing utility is an Android tool that saves device activity to a\ntrace file. On a device running Android 10 (API level 29) or higher, trace files\nare saved in Perfetto format, as shown later in this document. On a device\nrunning an earlier version of Android, trace files are saved in the Systrace\nformat.\n\nSystrace is a legacy platform-provided command-line tool that records device\nactivity over a short period of time in a compressed text file. The tool\nproduces a report that combines data from the Android kernel, such as the CPU\nscheduler, disk activity, and app threads. Systrace works on all Android\nplatform versions, but we recommend Perfetto for devices running Android 10 and\nhigher.\n**Figure 1.** A sample Perfetto trace view, which shows about 20 seconds\nof interaction with an app.\n**Figure 2.** A sample Systrace HTML report, which shows five seconds of\ninteraction with an app.\n\nBoth reports provide an overall picture of an Android-powered device's system\nprocesses for a given period of time. The report also inspects the captured\ntracing information to highlight problems that it observes, such as UI jank or\nhigh power consumption.\n\nPerfetto and Systrace are interoperable:\n\n- Open both Perfetto files and Systrace files in the Perfetto UI. Open Systrace files with the legacy Systrace viewer in the Perfetto UI by clicking the **Open with legacy UI** link.\n- [Convert a Perfetto trace to the legacy Systrace text\n format](https://docs.perfetto.dev/#/traceconv.md) using the `traceconv` tool.\n\n| **Note:** Systrace and Perfetto don't collect detailed information about code execution within your app process. For more detailed information about which methods your app is executing and how many CPU resources it's using, use the [CPU profiler](/studio/profile/cpu-profiler) in Android Studio.\n\nSystem tracing guides\n---------------------\n\nTo learn more about system tracing tools, see the following guides:\n\n[**Inspect CPU activity with CPU Profiler**](/studio/profile/cpu-profiler)\n: Shows how to profile your app's CPU usage and thread activity in Android\n Studio.\n\n[**Capture a system trace on a device**](/topic/performance/tracing/on-device)\n: Explains how to capture a system trace directly on any device running\n Android 9 (API level 28) or higher.\n\n[**Capture a system trace on the command line**](/topic/performance/tracing/command-line)\n: Defines the different options and flags that you can pass into the\n command-line interface for Systrace.\n\n[**Run Perfetto using adb**](/studio/command-line/perfetto)\n: Describes how to run the `perfetto` command-line tool to capture traces.\n\n[**Quickstart: Record traces on Android**](https://perfetto.dev/#/running.md)\n: External documentation that describes how to build and run the `perfetto`\n command-line tool to capture traces.\n\n[**Quickstart: Record traces on Android**](https://perfetto.dev/#/running.md)\n: The Perfetto web-based trace viewer opens Perfetto traces and displays a\n complete report. You can also open Systrace traces in this viewer using the\n legacy UI option.\n\n[**Navigate a Systrace report**](/topic/performance/tracing/navigate-report)\n: Lists the elements of a typical report, presents keyboard shortcuts for\n navigating through the report, and describes how to identify types of\n performance problems.\n\n[**Define custom events**](/topic/performance/tracing/custom-events)\n: Describes how you can apply custom labels to specific sections of your code,\n allowing for easier root-cause analysis in Systrace or Perfetto."]]