帧性能分析概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
借助 Android GPU 检查器 (AGI),您可以分析 Android 应用的特定帧,并使用该帧对应用的 GPU 使用情况进行深入分析。与仅使用系统性能分析相比,此性能分析数据可让您更深入地了解应用的 GPU 使用情况。
要使用 AGI 进行帧性能分析,首先会收集轨迹和其他性能数据,然后测量并显示这些数据以进行分析。
可用的帧性能分析数据包括:
Vulkan API 调用
帧缓冲区内容
渲染的网格绘制调用
命令的 RAM 和 GPU 内存值
渲染事件的 GPU 性能数据
流水线数据
渲染状态数据
纹理和着色器资源
开始使用
AGI 快速入门介绍了如何设置 AGI、捕获帧配置文件数据,然后打开生成的跟踪文件。下一部分将详细介绍配置选项。
性能分析选项
本部分介绍了拍摄帧配置文件时可用的主要选项。
Graphics API 选项
Graphics API 选项表示应用使用的图形 API。这些选项可在 Capture System Profile 对话框的 Type 列表中找到。
以下是可用的选项:
- Vulkan:适用于直接使用 Vulkan API 的应用。
- OpenGL on ANGLE:适用于使用 OpenGL ES 的应用。
AGI 会直接跟踪 Vulkan 命令。不过,如果您的应用使用 OpenGL ES,AGI 会使用自定义 ANGLE build 将命令转换为 Vulkan 命令,然后再跟踪应用。
其他参数
Additional Arguments 字段用于将额外的标志传递给 adb am start-activity
命令,该命令将发送到您的设备,以在分析期间启动应用。如需了解详情,请参阅 adb 命令。
开始时间和时长选项
在开始和时长部分,您可以指定 AGI 如何捕获要分析的帧。提供的选项如下:
跟踪选项
跟踪选项部分包含用于配置跟踪标志的设置。可用的设置如下:
停用缓冲:捕获数据时在设备上停用内存缓冲。此选项对于调试应用崩溃非常有用,因为它可以确保序列化到崩溃之前的所有跟踪数据。不过,在进行性能剖析时,这会略微增加 AGI 的开销。
包含不受支持的扩展程序:包含设备上的 AGI 不支持的扩展程序。如果您的应用使用 AGI 不支持的扩展程序,您可能会在重放轨迹时遇到不希望出现的行为,包括轻微的错误或崩溃。浏览支持的扩展程序列表。
清除软件包数据:使用 pm clear
adb 命令请求设备在启动前清除应用的用户数据。
输出设置
Output 部分包含跟踪文件存储设置,例如:
指定用于存储跟踪文件的目录。
修改为跟踪文件自动生成的文件名。
查看结果
当您打开包含帧性能分析数据的轨迹文件时,AGI 会在帧性能分析器界面中显示这些数据以进行分析。
帧性能分析器是一个 AGI 组件,用于管理用于分析单个帧的界面和插桩。帧性能分析器在以下界面元素中显示数据:
分析结果
以下主题介绍了如何使用 AGI 分析帧性能分析数据:
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Frame profiling overview\n\nWith Android GPU Inspector (AGI), you can profile a specific frame of your Android app\nand use it to perform an in-depth analysis of the app's GPU usage. This\nprofiling data can give you a deeper understand of your app's GPU usage than\nwith [system profiling](/agi/sys-trace/system-profiler) alone.\n\nFrame profiling with AGI starts by collecting traces and other performance data\nand then measuring and displaying it for analysis.\n\nThe available frame profiling data includes the following:\n\n- Vulkan API calls\n\n- Framebuffer content\n\n- Rendered mesh draw calls\n\n- RAM and GPU memory values for commands\n\n- GPU performance data for rendering events\n\n- Pipeline data\n\n- Render state data\n\n- Texture and shader resources\n\nGet started\n-----------\n\nThe AGI [quickstart](/agi/start) describes how to set up AGI, capture frame\nprofile data, and then open the resulting trace file. The next section describes\nthe configuration options in more detail.\n\nProfiling options\n-----------------\n\nThis sections describes the main options that are available when you\ncapture a frame profile.\n\n### Graphics API options\n\nThe Graphics API options indicate the graphics API used by your app. The options\nare available in the **Type** list of the **Capture System Profile** dialog.\nThese are the available options:\n\n- **Vulkan**: for apps that use the Vulkan API directly.\n- **OpenGL on ANGLE**: for apps that use OpenGL ES.\n\nAGI traces Vulkan commands directly. However, if your app uses OpenGL ES, AGI\nuses a custom [ANGLE](https://github.com/google/angle) build to\ntranslate the commands into Vulkan commands before tracing the app.\n\n### Additional arguments\n\nThe **Additional Arguments** field is for passing additional flags to the\nadb `am start-activity` command, which is sent to your device to start your app\nduring profiling. For more information, see\n[adb commands](/studio/command-line/adb).\n\n### Start and duration options\n\nIn the **Start and Duration** section, you can specify how AGI captures the\nframe to profile. The following options are available:\n\n- **Beginning**: AGI captures all commands from application startup to the end\n of the first rendered frame.\n\n- **Manual**: Press a button in the tracing dialog to manually capture the\n frame.\n\n- **Time**: AGI automatically captures a frame after the given number of seconds\n elapse.\n\n- **Frame**: AGI automatically captures the specified frame.\n\n### Trace options\n\nThe **Trace Options** section contains settings that configure tracing flags.\nThese are the available settings:\n\n- **Disable Buffering**: Disable memory buffering on the device when capturing\n data. This option is useful for debugging an app crash because it ensures\n that all tracing data is serialized up to the crash. However, it slightly\n increases the overhead of AGI during profiling.\n\n- **Include Unsupported Extensions** : Include extensions that are not supported\n by AGI on the device. If your app uses an extension that isn't supported by\n AGI, you might encounter undesirable behavior, including subtle errors or\n crashes, when replaying the trace. Browse\n [a list of supported extensions](/agi/vulkan-extensions).\n\n- **Clear Package Data** : Use the `pm clear`\n [adb command](/studio/command-line/adb) to request that the device clear your\n app's user data before launching.\n\n### Output settings\n\nThe **Output** section contains settings for trace file storage, such as:\n\n- Specify the directory to store the trace file.\n\n- Modify the automatically generated file name for the trace file.\n\nView the results\n----------------\n\nWhen you open a trace file that contains frame profiling data, AGI displays the\ndata in the Frame Profiler UI for analysis.\n\nFrame Profiler is the AGI component that manages the UI and\ninstrumentation for profiling an individual frame.\nFrame Profiler displays data in the following UI\nelements:\n\n- [**Commands** pane](/agi/frame-trace-gui/commands-pane):\n Vulkan API calls.\n\n- [**Framebuffer** pane](/agi/frame-trace-gui/framebuffer-pane):\n Framebuffer content.\n\n- [**Geometry** pane](/agi/frame-trace-gui/geometry-pane):\n Rendering of mesh draw calls.\n\n- [**Memory** pane](/agi/frame-trace-gui/memory-pane):\n RAM and GPU memory values for commands.\n\n- [**Performance** pane](/agi/frame-trace-gui/perftab-pane):\n GPU performance data for rendering events.\n\n- [**Pipeline** pane](/agi/frame-trace-gui/pipeline-pane):\n Pipeline content.\n\n- [**Shader** pane](/agi/frame-trace-gui/shader-pane):\n Shader content.\n\n- [**State** pane](/agi/frame-trace-gui/state-pane):\n The render state for submitted commands.\n\n- [**Textures** pane](/agi/frame-trace-gui/textures-pane):\n A list of texture resources that are associated with a command.\n\n- [**Texture** pane](/agi/frame-trace-gui/texture-pane):\n The content of a selected texture resource.\n\n- [**Report** pane](/agi/frame-trace-gui/report-pane):\n A list of profiling errors.\n\nAnalyze the results\n-------------------\n\nThese topics describe how to analyze frame profiling data with AGI:\n\n- [Analyze render passes](/agi/frame-trace/renderpasses)\n- [Analyze shader performance](/agi/frame-trace/shader-performance)\n- [Analyze vertex formats](/agi/frame-trace/vertex-formats)"]]