46 lines
1.1 KiB
Markdown
46 lines
1.1 KiB
Markdown
|
|
# Profiler::ExportChromeTracing
|
|||
|
|
|
|||
|
|
```cpp
|
|||
|
|
void ExportChromeTracing(const Containers::String& filePath)
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**状态:** 此方法目前为空实现,暂未功能。
|
|||
|
|
|
|||
|
|
将收集的性能数据导出为 Chrome Tracing JSON 格式。导出的文件可通过 Chrome 浏览器打开(地址栏输入 `chrome://tracing` 并加载文件)进行可视化分析。
|
|||
|
|
|
|||
|
|
**参数:**
|
|||
|
|
- `filePath` - 输出文件路径
|
|||
|
|
|
|||
|
|
**复杂度:** O(n),n 为记录的样本数量
|
|||
|
|
|
|||
|
|
**示例:**
|
|||
|
|
|
|||
|
|
```cpp
|
|||
|
|
#include <XCEngine/Debug/Profiler.h>
|
|||
|
|
|
|||
|
|
XCEngine::Debug::Profiler::Get().Initialize();
|
|||
|
|
|
|||
|
|
void RenderFrame() {
|
|||
|
|
XCEngine::Debug::Profiler::Get().BeginFrame();
|
|||
|
|
XE_PROFILE_FUNCTION();
|
|||
|
|
|
|||
|
|
XE_PROFILE_BEGIN("UpdateScene");
|
|||
|
|
UpdateScene();
|
|||
|
|
XE_PROFILE_END();
|
|||
|
|
|
|||
|
|
XE_PROFILE_BEGIN("DrawScene");
|
|||
|
|
DrawScene();
|
|||
|
|
XE_PROFILE_END();
|
|||
|
|
|
|||
|
|
XCEngine::Debug::Profiler::Get().EndFrame();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 运行一段时间后导出
|
|||
|
|
XCEngine::Debug::Profiler::Get().ExportChromeTracing("trace.json");
|
|||
|
|
XCEngine::Debug::Profiler::Get().Shutdown();
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 相关文档
|
|||
|
|
|
|||
|
|
- [Profiler 总览](profiler.md) - 返回类总览
|