diff --git a/src/vt/runnable/runnable.cc b/src/vt/runnable/runnable.cc index 48c78ed8f2..319f41aa83 100644 --- a/src/vt/runnable/runnable.cc +++ b/src/vt/runnable/runnable.cc @@ -124,7 +124,20 @@ void RunnableNew::run() { { needs_time = contexts_.lb.needsTime(); } - TimeType start_time = needs_time ? theSched()->getRecentTime() : TimeType{NAN}; + + auto getTime = [&]() { +#if vt_check_enabled(trace_enabled) + if (theTrace()) { + return timing::getCurrentTime(); + } + else +#endif + { + return theSched()->getRecentTime(); + } + }; + + TimeType start_time = needs_time ? getTime() : TimeType{NAN}; #if vt_check_enabled(fcontext) if (suspended_) { @@ -175,7 +188,7 @@ void RunnableNew::run() { #endif } theSched()->setRecentTimeToStale(); - TimeType end_time = needs_time ? theSched()->getRecentTime() : TimeType{NAN}; + TimeType end_time = needs_time ? getTime() : TimeType{NAN};