From 6bdd801e0745cfadb1afe7c19ed8140f30bddbf3 Mon Sep 17 00:00:00 2001 From: Shivam Raikundalia Date: Thu, 12 Sep 2024 14:43:24 -0700 Subject: [PATCH] Extend CPU User Annotations to End of Profile Summary: If a CPU User Annotation doesn't end by the time the profile ends, the annotation is marked as a 0-length event. This can be annoying to look at because it seems like profiler just never got the annotation event when it did. Lets set the end time to the end of profiling. Differential Revision: D62604717 --- libkineto/src/CuptiActivityProfiler.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libkineto/src/CuptiActivityProfiler.cpp b/libkineto/src/CuptiActivityProfiler.cpp index 1509de00f..6b972b619 100644 --- a/libkineto/src/CuptiActivityProfiler.cpp +++ b/libkineto/src/CuptiActivityProfiler.cpp @@ -381,6 +381,9 @@ void CuptiActivityProfiler::processCpuTrace( const std::unique_ptr>::value, "handleActivity is unsafe and relies on the caller to maintain not " "only lifetime but also address stability."); + if (act->type() == ActivityType::USER_ANNOTATION && act->duration()<=0){ + act->endTime = captureWindowEndTime_; + } logger.handleActivity(*act); } clientActivityTraceMap_[act->correlationId()] = &span_pair;