docs: rebuild Debug API content
This commit is contained in:
@@ -1,31 +1,51 @@
|
||||
# Profiler::BeginProfile
|
||||
|
||||
公开方法,详见头文件声明。
|
||||
开始一个具名 profile 区段。
|
||||
|
||||
```cpp
|
||||
void BeginProfile(const char* name);
|
||||
```
|
||||
|
||||
该方法声明于 `XCEngine/Debug/Profiler.h`,当前页面用于固定 `Profiler` 类目录下的方法级 canonical 路径。
|
||||
## 行为说明
|
||||
|
||||
**参数:**
|
||||
- `name` - 参数语义详见头文件声明。
|
||||
当前实现会把一个新的 `ProfileNode` 压入内部栈,记录:
|
||||
|
||||
**返回:** `void` - 无返回值。
|
||||
- `name`
|
||||
- 当前微秒时间
|
||||
- 当前线程哈希值
|
||||
|
||||
**示例:**
|
||||
它不会检查:
|
||||
|
||||
- `Profiler` 是否已经 `Initialize`
|
||||
- `name` 是否为空
|
||||
- 是否来自同一线程
|
||||
|
||||
因此当前 API 更适合“明确受控、单线程成对调用”的埋点场景。
|
||||
|
||||
## 参数
|
||||
|
||||
- `name` - 区段名称,通常使用固定字符串或函数名。
|
||||
|
||||
## 返回值
|
||||
|
||||
- 无。
|
||||
|
||||
## 线程语义
|
||||
|
||||
- 必须与 [EndProfile](EndProfile.md) 在同一线程、按栈顺序配对使用。
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Debug/Profiler.h>
|
||||
using namespace XCEngine::Debug;
|
||||
|
||||
void Example() {
|
||||
XCEngine::Debug::Profiler object;
|
||||
// 根据上下文补齐参数后调用 Profiler::BeginProfile(...)。
|
||||
(void)object;
|
||||
}
|
||||
Profiler::Get().BeginProfile("ShadowPass");
|
||||
// ... CPU work ...
|
||||
Profiler::Get().EndProfile();
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [返回类总览](Profiler.md)
|
||||
- [返回模块目录](../Debug.md)
|
||||
- [返回类型总览](Profiler.md)
|
||||
- [EndProfile](EndProfile.md)
|
||||
- [Profiler Workflow](../../../_guides/Debug/Profiler-Workflow.md)
|
||||
|
||||
Reference in New Issue
Block a user