[null,null,["最后更新时间 (UTC):2025-07-29。"],[],[],null,["# Retrieve and analyze profiling data\n\nThis page describes how to retrieve traces and visualize them in the Perfetto UI.\n\nRetrieve traces\n---------------\n\nAfter a profile is recorded, traces are saved on your device. Before you can\nanalyze these traces, you have to retrieve them.\n\nTrace locations are provided by [`ProfilingResult.getResultFilePath()`](/reference/android/os/ProfilingResult#getResultFilePath()).\nTo learn how to get the trace location,\nsee [How to capture a profile](/topic/performance/tracing/profiling-manager/how-to-capture). Once you have\nthe location of your trace, you can upload the trace to a server.\n\n### Local Testing: Retrieve traces using ADB\n\nUsing `adb` to get traces is helpful for checking performance and debugging\nlocally.\n\nRedacted traces are saved in your device's files. A typical path for a saved\nprofile is:\n\n`/data/user/0/`\u003cvar translate=\"no\"\u003e<app>\u003c/var\u003e`/files/profiling/profile`*\u003cvar translate=\"no\"\u003e<tag>\u003c/var\u003e* \u003cvar translate=\"no\"\u003e<datetime>\u003c/var\u003e`.perfetto-trace`\n\nWhere:\n\n- `\u003capp\u003e` is the app name.\n- `\u003cdatetime\u003e` is the date and time the trace was taken.\n- `\u003ctag\u003e` is the user-provided tag configured using [`setTag`](/reference/kotlin/androidx/core/os/ProfilingRequestBuilder#setTag(kotlin.String))\n\n| **Note:** To find the exact recording location, check the [`ProfilingResult.getResultFilePath`](/reference/android/os/ProfilingResult#getResultFilePath()) API.\n| **Key Point:** For debugging purposes, you can enable a [debug command](/topic/performance/tracing/profiling-manager/debug-mode#enable-unredacted-traces) that instructs `ProfilingManager` to also store an unredacted version of the recorded traces. These unredacted traces are saved in the `/data/misc/perfetto-traces/profiling` directory.\n\nIf unredacted traces are enabled and saved, use the following `adb` command to\npull them from the device:\n\n`adb pull /data/misc/perfetto-traces/profiling/\u003ctrace-name\u003e.perfetto-trace-unredacted`\n| **Note:** The first 20 alphanumeric characters of the tag provided in `setTag()` are included in the `\u003ctrace-name\u003e`, along with details like the profile type and date.\n\nVisualize traces\n----------------\n\nAfter retrieving your trace to your computer, you can then [view it in the\nPerfetto UI](https://perfetto.dev/docs/getting-started/system-tracing#viewing-your-first-trace).\n**Figure 1.**: Redacted trace example.\n\nIn a redacted trace, the `OtherProcesses` section combines all CPU activity from\nother processes. Combining processes keeps what those other processes were doing\nprivate.\n\nHowever, seeing this combined CPU activity still lets you check if the system\nwas overloaded during your recording. Checking the system activity helps you\nfigure out if your app was slow because of an internal issue or because the\nsystem was generally slow.\n| **Note:** Traces from `ProfilingManager` are different from those taken directly using Perfetto locally because redaction is applied.\n\nThe following image highlights and briefly describes the main parts you will see\nin the trace:\n**Figure 2.**: Sections of a redacted trace.\n\n1. **CPU list**: Displays all available processors on your device.\n2. **CPU tasks**: Shows which threads each CPU was executing.\n3. **Other processes view**: Displays CPU resources consumed by other processes.\n4. **Process View**: Shows your app's process.\n5. **Threads View**: Displays threads running within your process and their thread states (Runnable (R), Running (R), Sleeping (S), Uninterruptible Sleep (D)), which map directly to Linux Process States.\n6. **Trace slices** : This section shows trace annotations added by app developers or the framework. These annotations encompass computations between [`Trace.beginSection`](/reference/androidx/tracing/Trace#beginSection(kotlin.String)) and [`Trace.endSection`](/reference/androidx/tracing/Trace#endSection()).\n\nFor more information on Perfetto UI and trace visualization, see the [Perfetto docs](https://perfetto.dev/docs/visualization/perfetto-ui)."]]