影格剖析總覽
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您可以使用 Android GPU Inspector (AGI) 剖析 Android 應用程式的特定影格,然後使用這個影格執行應用程式的 GPU 用量深入分析。與單獨進行系統剖析相比,這些剖析資料可讓您更深入瞭解應用程式的 GPU 用量。
使用 AGI 進行影格剖析作業的第一步是收集追蹤記錄和其他效能資料,然後評估並顯示資料以供分析。
可用的影格剖析資料包括:
Vulkan API 呼叫
影格緩衝區內容
轉譯的網格繪製呼叫
指令的 RAM 和 GPU 記憶體值
轉譯事件的 GPU 效能資料
管道資料
轉譯狀態資料
紋理和著色器資源
開始使用
AGI 快速入門導覽課程說明如何設定 AGI、擷取影格設定檔資料,然後開啟產生的追蹤檔。下一節將詳細說明設定選項。
剖析選項
本節說明擷取影格設定檔時,可用的主要選項。
圖形 API 選項
Graphics API 選項會指出應用程式使用的圖形 API。選項可在「Capture System Profile」對話方塊的「Type」清單中。可用選項如下:
- Vulkan:適用於直接使用 Vulkan API 的應用程式。
- OpenGL on ANGLE:適用於採用 OpenGL ES 的應用程式。
AGI 會直接追蹤 Vulkan 指令。但是,如果您的應用程式使用 OpenGL ES,AGI 就會使用自訂的 ANGLE 版本將指令轉譯為 Vulkan 指令,接著再追蹤應用程式。
其他引數
「Additional Arguments」欄位是用於將其他標記傳送至 ADB am start-activity
指令,後者會在剖析期間傳送至您的裝置以啟動應用程式。詳情請參閱 ADB 指令。
開始和時間長度選項
在「Start and Duration」(開始與時間長度) 區段中,指定 AGI 擷取影格並剖析的方式。可用的選項如下:
追蹤選項
「追蹤選項」區段包含可設定追蹤標記的設定。以下是可用的設定:
停用緩衝區:擷取資料時,停用裝置的記憶體緩衝功能。這個選項有助於對應用程式當機問題進行偵錯,因為這樣可確保所有追蹤資料均已在當機前序列化。不過,這在剖析期間會稍微增加 AGI 的負擔。
包含不支援的擴充功能:加入裝置 AGI 不支援的擴充功能。如果您的應用程式使用 AGI 不支援的擴充功能,您可能會在重播追蹤記錄時遇到不想要的行為,包括輕微的錯誤或當機。瀏覽支援的擴充功能清單。
清除套件資料:使用 pm clear
ADB 指令,要求裝置在啟動前清除應用程式的使用者資料。
輸出設定
「Output」區段包含追蹤檔案儲存空間的設定,例如:
指定要儲存追蹤檔的目錄。
修改系統自動產生的追蹤檔檔案名稱。
查看結果
如果您開啟含有影格剖析資料的追蹤檔,AGI 就會在影格分析器 UI 中顯示資料進行分析。
影格分析器是一種 AGI 元件,可管理用於剖析個別影格的 UI 和檢測作業。影格分析器會在下列 UI 元素中顯示資料:
分析結果
以下主題說明如何使用 AGI 分析影格剖析資料:
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-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-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)"]]