Skip to content

Commit

Permalink
#2150: Trace: Fix trace issues with new Time's type
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDomagala committed Jun 6, 2023
1 parent 8a8b807 commit 034ca8c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/vt/event/event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/vt/messaging/active.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -579,7 +579,7 @@ std::tuple<EventType, int> 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();
}
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/vt/messaging/request_holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
8 changes: 4 additions & 4 deletions src/vt/trace/trace_user.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -110,10 +110,10 @@ void addUserBracketedNote(

#if vt_check_enabled(trace_enabled)
struct UserSplitHolder final {
static std::unordered_map<std::string, double> split_;
static std::unordered_map<std::string, TimeType> split_;
};

/*static*/ std::unordered_map<std::string, double> UserSplitHolder::split_ = {};
/*static*/ std::unordered_map<std::string, TimeType> UserSplitHolder::split_ = {};
#endif

void addUserNotePre(std::string const& note, TraceEventIDType const) {
Expand Down
19 changes: 10 additions & 9 deletions src/vt/trace/trace_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

#include "vt/config.h"
#include "vt/trace/trace_common.h"
#include "vt/timing/timing_type.h"

#include <string>

Expand Down Expand Up @@ -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
);

Expand Down Expand Up @@ -184,15 +185,15 @@ 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;
}
}

private:
double begin_ = 0.0;
TimeType begin_ = TimeType{0.0};
std::string str_ = "";
UserEventIDType event_ = no_user_event_id;
};
Expand All @@ -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)
{ }

Expand All @@ -240,15 +241,15 @@ 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;
}
}

private:
double begin_ = 0.0;
TimeType begin_ = TimeType{0.0};
UserEventIDType event_ = no_user_event_id;
};

Expand All @@ -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)
{ }
Expand Down Expand Up @@ -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;
Expand All @@ -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_ = "";
};
Expand Down

0 comments on commit 034ca8c

Please sign in to comment.