docs: rebuild Debug API content
This commit is contained in:
@@ -1,30 +1,48 @@
|
||||
# Profiler::EndProfile
|
||||
|
||||
公开方法,详见头文件声明。
|
||||
结束最近一次开始的 profile 区段,并记录其耗时。
|
||||
|
||||
```cpp
|
||||
void EndProfile();
|
||||
```
|
||||
|
||||
该方法声明于 `XCEngine/Debug/Profiler.h`,当前页面用于固定 `Profiler` 类目录下的方法级 canonical 路径。
|
||||
## 行为说明
|
||||
|
||||
**参数:** 无。
|
||||
当前实现会:
|
||||
|
||||
**返回:** `void` - 无返回值。
|
||||
1. 检查内部栈是否为空;为空则直接返回。
|
||||
2. 读取当前微秒时间作为结束时间。
|
||||
3. 弹出最近一个 `ProfileNode`。
|
||||
4. 计算区段耗时并把结果追加到内部 `m_samples`。
|
||||
|
||||
**示例:**
|
||||
当前不会:
|
||||
|
||||
- 验证开始与结束是否发生在同一线程。
|
||||
- 提供读取样本的公开 API。
|
||||
|
||||
## 参数
|
||||
|
||||
- 无。
|
||||
|
||||
## 返回值
|
||||
|
||||
- 无。
|
||||
|
||||
## 线程语义
|
||||
|
||||
- 必须与 [BeginProfile](BeginProfile.md) 形成正确的 LIFO 配对。
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Debug/Profiler.h>
|
||||
using namespace XCEngine::Debug;
|
||||
|
||||
void Example() {
|
||||
XCEngine::Debug::Profiler object;
|
||||
// 根据上下文补齐参数后调用 Profiler::EndProfile(...)。
|
||||
(void)object;
|
||||
}
|
||||
Profiler::Get().BeginProfile("FrameBuild");
|
||||
// ...
|
||||
Profiler::Get().EndProfile();
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [返回类总览](Profiler.md)
|
||||
- [返回模块目录](../Debug.md)
|
||||
- [返回类型总览](Profiler.md)
|
||||
- [BeginProfile](BeginProfile.md)
|
||||
|
||||
Reference in New Issue
Block a user