未验证 提交 89a70c76 编写于 作者: L liutiexing 提交者: GitHub

Update profiler (#40460)

上级 e14a6ec9
......@@ -77,7 +77,9 @@ RecordEvent::RecordEvent(const char *name, const TracerEventType type,
#endif
#endif
if (FLAGS_enable_host_event_recorder_hook == false) {
if (g_state != ProfilerState::kDisabled) { // avoid temp string
OriginalConstruct(name, role, "none");
}
return;
}
if (UNLIKELY(HostTraceLevel::GetInstance().NeedTrace(level) == false)) {
......@@ -165,8 +167,8 @@ void RecordEvent::End() {
}
#endif
#endif
uint64_t end_ns = PosixInNsec();
if (LIKELY(FLAGS_enable_host_event_recorder_hook && is_enabled_)) {
uint64_t end_ns = PosixInNsec();
if (LIKELY(shallow_copy_name_ != nullptr)) {
HostEventRecorder::GetInstance().RecordEvent(
shallow_copy_name_, start_ns_, end_ns, role_, type_);
......@@ -190,6 +192,7 @@ void RecordEvent::End() {
// lock is not needed, the code below is thread-safe
DeviceTracer *tracer = GetDeviceTracer();
if (tracer) {
uint64_t end_ns = PosixInNsec();
tracer->AddCPURecords(CurAnnotationName(), start_ns_, end_ns, BlockDepth(),
g_thread_id);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册