# 性能分析工具

> Reference for various profiling tools available for performance analysis.

对应用程序进行[性能分析](https://en.wikipedia.org/wiki/Profiling_\(computer_programming\))是衡量其性能的最佳方法。可以使用各种性能分析工具了解应用程序元素可能存在的任何问题（包括内存使用情况、CPU 性能、GPU 性能和自定义脚本）。

## Unity 的性能分析工具

Unity 提供多种性能分析工具，均可用于衡量应用程序的性能：

* [Unity 性能分析器](/engine/6000.0/manual/analysis/profiler.md)：衡量 Unity 编辑器和运行模式下应用程序的性能，或连接到在开发模式下运行应用程序的设备。
* [Profiling Core 包](https://docs.unity3d.com/Packages/com.unity.profiling.core@latest)：提供的 API 可用于向 Unity 性能分析器捕获添加上下文信息
* [Memory Profiler](https://docs.unity3d.com/Packages/com.unity.memoryprofiler@latest)：该工具提供深入的内存性能分析
* [Profile Analyzer](https://docs.unity3d.com/Packages/com.unity.performance.profile-analyzer@latest)：将两个性能分析数据集进行比较，以分析更改对应用程序性能的影响。
* [帧调试器](/engine/6000.0/manual/rendering-and-post-processing/graphics-performance-profiling/profile-rendering/frame-debugger/frame-debugger.md)：该工具可用于衡量应用程序的图形性能。

### 第三方性能分析工具

除了 Unity 性能分析器外，使用特定于平台的性能分析器也可确保应用程序按预期运行。以下列表提供了可用性能分析工具的部分示例。也可以使用 Unity 的[低级原生插件 Profiler API](/engine/6000.0/manual/scripting/compilation-and-code-reload/plug-ins/native-plugin-interface/low-level-native-plugin-profiler.md) 将性能分析数据导出到第三方性能分析工具。

* **Android：**

  * 常规 Android GPU 性能分析：Google 的 [Android GPU Inspector](https://developer.android.com/agi)（如果设备支持）。
  * Arm CPU：Arm Mobile Studio 的 [Streamline](https://developer.arm.com/tools-and-software/embedded/arm-development-studio/components/streamline-performance-analyzer)。
  * Arm Mali GPU：使用 [Arm Mobile Studio](https://developer.arm.com/solutions/hpc/hpc-software/categories/profiling-tools) 的工具进行 GPU 和系统性能分析。
  * Imagination PowerVR GPU：用于 GPU 性能分析的 [PVRTune](https://developer.imaginationtech.com/pvrtune/)。
  * Qualcomm 芯片：用于 GPU 和系统性能分析的 [Snapdragon Profiler](https://developer.qualcomm.com/software/snapdragon-profiler)。

* **macOS 和 iOS**：

  * [Xcode](https://developer.apple.com/xcode/)
  * [Xcode GPU Frame Capture](https://developer.apple.com/documentation/metal/frame_capture_debugging_tools/)

* **PC：**

  * [AMD uProf](https://developer.amd.com/amd-uprof/)
  * [Intel GPA](https://www.intel.com/content/www/us/en/developer/tools/graphics-performance-analyzers/overview.html)
  * [NVIDIA Nsight Graphics](https://developer.nvidia.com/nsight-graphics)
  * [PIX on Windows](https://devblogs.microsoft.com/pix/download/)
  * [Superluminal](https://superluminal.eu/)
  * [VTune](https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler.html)
  * [Windows 性能分析工具包](https://docs.microsoft.com/en-us/windows-hardware/test/wpt/)
  * [Visual Studio 图形调试器](http://msdn.microsoft.com/en-us/library/hh315751.aspx)
  * [RenderDoc](https://github.com/baldurk/renderdoc)
  * [Radeon 开发者工具套件](https://gpuopen.com/introducing-radeon-developer-tool-suite/)
  * [GPU Driver Instruments](https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Instrument-GPUDriver.html)

这些工具在可以使用 [IL2CPP](/engine/6000.0/manual/scripting/compilation-and-code-reload/backends/il2cpp.md) 生成 C++ 版项目的平台上实用性最高。这些原生代码版本提供透明调用堆栈和高分辨率方法计时，它们在 Mono 下运行时无法使用。
