36 lines
695 B
Markdown
36 lines
695 B
Markdown
# Profiler::Get
|
|
|
|
获取进程级全局 `Profiler` 实例。
|
|
|
|
```cpp
|
|
static Profiler& Get();
|
|
```
|
|
|
|
## 行为说明
|
|
|
|
当前实现使用函数内静态对象保存单例,整个进程只存在一个 `Profiler` 实例。它不会在 `Get()` 时自动初始化或清空样本。
|
|
|
|
## 参数
|
|
|
|
- 无。
|
|
|
|
## 返回值
|
|
|
|
- `Profiler&` - 全局 profiler 引用。
|
|
|
|
## 线程语义
|
|
|
|
- 单例构造本身由 C++ 保证线程安全;后续使用仍需遵守当前 profiler 不支持并发埋点的限制。
|
|
|
|
## 示例
|
|
|
|
```cpp
|
|
XCEngine::Debug::Profiler& profiler = XCEngine::Debug::Profiler::Get();
|
|
profiler.Initialize();
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [返回类型总览](Profiler.md)
|
|
- [Initialize](Initialize.md)
|