From b4b295c7cfc381684af334f6e82683342ec55ecf Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Fri, 26 May 2023 13:50:50 +0200 Subject: [PATCH] #2150: Trace: Fix trace issues with new Time's type --- src/vt/event/event.cc | 2 +- src/vt/messaging/active.cc | 8 ++++---- src/vt/messaging/request_holder.h | 2 +- src/vt/trace/trace_user.cc | 8 ++++---- src/vt/trace/trace_user.h | 19 ++++++++++--------- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/vt/event/event.cc b/src/vt/event/event.cc index 59737386cc..d3de8b195c 100644 --- a/src/vt/event/event.cc +++ b/src/vt/event/event.cc @@ -304,7 +304,7 @@ AsyncEvent::EventStateType AsyncEvent::testEventComplete(EventType const& event) void AsyncEvent::testEventsTrigger(int const& num_events) { # if vt_check_enabled(trace_enabled) int32_t num_completed = 0; - TimeType tr_begin = 0.0; + auto tr_begin = TimeType{0.0}; if (theConfig()->vt_trace_event_polling) { tr_begin = timing::getCurrentTime(); diff --git a/src/vt/messaging/active.cc b/src/vt/messaging/active.cc index 9ab3235191..a0eca38400 100644 --- a/src/vt/messaging/active.cc +++ b/src/vt/messaging/active.cc @@ -347,7 +347,7 @@ EventType ActiveMessenger::sendMsgMPI( { VT_ALLOW_MPI_CALLS; #if vt_check_enabled(trace_enabled) - double tr_begin = 0; + auto tr_begin = TimeType{0.}; if (theConfig()->vt_trace_mpi) { tr_begin = vt::timing::getCurrentTime(); } @@ -579,7 +579,7 @@ std::tuple ActiveMessenger::sendDataMPI( ); { #if vt_check_enabled(trace_enabled) - double tr_begin = 0; + auto tr_begin = TimeType{0.}; if (theConfig()->vt_trace_mpi) { tr_begin = vt::timing::getCurrentTime(); } @@ -769,7 +769,7 @@ void ActiveMessenger::recvDataDirect( ); #if vt_check_enabled(trace_enabled) - double tr_begin = 0; + auto tr_begin = TimeType{0.}; if (theConfig()->vt_trace_mpi) { tr_begin = vt::timing::getCurrentTime(); } @@ -1006,7 +1006,7 @@ bool ActiveMessenger::tryProcessIncomingActiveMsg() { { #if vt_check_enabled(trace_enabled) - double tr_begin = 0; + auto tr_begin = TimeType{0.}; if (theConfig()->vt_trace_mpi) { tr_begin = vt::timing::getCurrentTime(); } diff --git a/src/vt/messaging/request_holder.h b/src/vt/messaging/request_holder.h index 5f5bb7dd2c..bf48e5b098 100644 --- a/src/vt/messaging/request_holder.h +++ b/src/vt/messaging/request_holder.h @@ -98,7 +98,7 @@ struct RequestHolder { bool testAll(Callable c, int& num_mpi_tests) { # if vt_check_enabled(trace_enabled) std::size_t const holder_size_start = holder_.size(); - TimeType tr_begin = 0.0; + auto tr_begin = TimeType{0.0}; if (theConfig()->vt_trace_irecv_polling) { tr_begin = vt::timing::getCurrentTime(); } diff --git a/src/vt/trace/trace_user.cc b/src/vt/trace/trace_user.cc index ab79a9423e..ee4754ffbf 100644 --- a/src/vt/trace/trace_user.cc +++ b/src/vt/trace/trace_user.cc @@ -81,7 +81,7 @@ void addUserEvent(UserEventIDType event) { #endif } -void addUserEventBracketed(UserEventIDType event, double begin, double end) { +void addUserEventBracketed(UserEventIDType event, TimeType begin, TimeType end) { #if vt_check_enabled(trace_enabled) theTrace()->addUserEventBracketed(event, begin, end); #endif @@ -100,7 +100,7 @@ void addUserData(int32_t data) { } void addUserBracketedNote( - double const begin, double const end, std::string const& note, + TimeType const begin, TimeType const end, std::string const& note, TraceEventIDType const event ) { #if vt_check_enabled(trace_enabled) @@ -110,10 +110,10 @@ void addUserBracketedNote( #if vt_check_enabled(trace_enabled) struct UserSplitHolder final { - static std::unordered_map split_; + static std::unordered_map split_; }; -/*static*/ std::unordered_map UserSplitHolder::split_ = {}; +/*static*/ std::unordered_map UserSplitHolder::split_ = {}; #endif void addUserNotePre(std::string const& note, TraceEventIDType const) { diff --git a/src/vt/trace/trace_user.h b/src/vt/trace/trace_user.h index f96ef28c24..a5dbc0809e 100644 --- a/src/vt/trace/trace_user.h +++ b/src/vt/trace/trace_user.h @@ -46,6 +46,7 @@ #include "vt/config.h" #include "vt/trace/trace_common.h" +#include "vt/timing/timing_type.h" #include @@ -127,7 +128,7 @@ void addUserData(int32_t data); * \param[in] event the event ID to log */ void addUserBracketedNote( - double const begin, double const end, std::string const& note, + TimeType const begin, TimeType const end, std::string const& note, TraceEventIDType const event = no_trace_event ); @@ -184,7 +185,7 @@ struct TraceScopedEventHash final { */ void end() { if (event_ != no_user_event_id) { - double end = TraceLite::getCurrentTime(); + auto end = TraceLite::getCurrentTime(); theTrace()->addUserEventBracketed(event_, begin_, end); event_ = no_user_event_id; @@ -192,7 +193,7 @@ struct TraceScopedEventHash final { } private: - double begin_ = 0.0; + TimeType begin_ = TimeType{0.0}; std::string str_ = ""; UserEventIDType event_ = no_user_event_id; }; @@ -214,7 +215,7 @@ struct TraceScopedEvent final { * \c registerEventCollective ) */ explicit TraceScopedEvent(UserEventIDType event) - : begin_(event != no_user_event_id ? TraceLite::getCurrentTime() : 0), + : begin_(event != no_user_event_id ? TraceLite::getCurrentTime() : TimeType{0.}), event_(event) { } @@ -240,7 +241,7 @@ struct TraceScopedEvent final { */ void end() { if (event_ != no_user_event_id) { - double end = TraceLite::getCurrentTime(); + auto end = TraceLite::getCurrentTime(); theTrace()->addUserEventBracketed(event_, begin_, end); event_ = no_user_event_id; @@ -248,7 +249,7 @@ struct TraceScopedEvent final { } private: - double begin_ = 0.0; + TimeType begin_ = TimeType{0.0}; UserEventIDType event_ = no_user_event_id; }; @@ -271,7 +272,7 @@ struct TraceScopedNote final { */ TraceScopedNote( std::string const& in_note, TraceEventIDType const in_event = no_trace_event - ) : begin_(in_event != no_trace_event ? TraceLite::getCurrentTime() : 0), + ) : begin_(in_event != no_trace_event ? TraceLite::getCurrentTime() : TimeType{0.}), event_(in_event), note_(in_note) { } @@ -300,7 +301,7 @@ struct TraceScopedNote final { */ void end() { if (event_ != no_user_event_id) { - double end = TraceLite::getCurrentTime(); + auto end = TraceLite::getCurrentTime(); theTrace()->addUserBracketedNote(begin_, end, note_, event_); event_ = no_user_event_id; @@ -312,7 +313,7 @@ struct TraceScopedNote final { } private: - double begin_ = 0.0; + TimeType begin_ = TimeType{0.0}; TraceEventIDType event_ = no_trace_event; std::string note_ = ""; };