Files
XCEngine/docs/api/debug/profiler/markevent.md

41 lines
983 B
Markdown

# Profiler::MarkEvent
```cpp
void MarkEvent(const char* name, uint64_t timestamp, uint32_t threadId)
```
**状态:** 此方法目前为空实现,暂未功能。
在指定时间点标记一个事件。用于记录离散的瞬时事件,如 GPU 命令提交、状态切换等,通常用于多线程性能分析。
**参数:**
- `name` - 事件名称
- `timestamp` - 事件发生的时间戳(微秒)
- `threadId` - 事件所属的线程 ID
**返回:** `void`
**线程安全:** ✅ 线程安全
**复杂度:** O(1)
**示例:**
```cpp
#include <XCEngine/Debug/Profiler.h>
// 在多线程场景中标记事件
void WorkerThread() {
uint32_t tid = GetCurrentThreadId();
uint64_t ts = GetTickCount();
XCEngine::Debug::Profiler::Get().MarkEvent("TaskStarted", ts, tid);
DoWork();
XCEngine::Debug::Profiler::Get().MarkEvent("TaskCompleted", GetTickCount(), tid);
}
```
## 相关文档
- [Profiler 总览](profiler.md) - 返回类总览