# Profiler::BeginProfile ```cpp void BeginProfile(const char* name) ``` 开始一个性能分析块。将分析节点压入栈中并记录开始时间。每次调用 `BeginProfile` 应与一次 `EndProfile` 配对使用。 **参数:** - `name` - 分析块的名称,用于在导出结果中标识 **复杂度:** O(1) **示例:** ```cpp #include void ProcessMesh() { XCEngine::Debug::Profiler::Get().BeginProfile("ProcessMesh"); XCEngine::Debug::Profiler::Get().BeginProfile("ComputeVertices"); ComputeVertices(); XCEngine::Debug::Profiler::Get().EndProfile(); XCEngine::Debug::Profiler::Get().BeginProfile("ComputeIndices"); ComputeIndices(); XCEngine::Debug::Profiler::Get().EndProfile(); XCEngine::Debug::Profiler::Get().EndProfile(); } ``` ## 相关文档 - [Profiler 总览](profiler.md) - 返回类总览