Skip to content

Commit

Permalink
#2187: Fix order of the parametrs in the method for starting a user note
Browse files Browse the repository at this point in the history
  • Loading branch information
thearusable committed Aug 28, 2024
1 parent 2f8517d commit 03e7a8d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/vt/trace/trace_lite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void TraceLite::addUserEventBracketedEndTime(
}

void TraceLite::addUserNoteBracketedBeginTime(
std::string const& note, TraceEventIDType const event
TraceEventIDType const event, std::string const& note
) {
if (not checkDynamicRuntimeEnabled()) {
return;
Expand Down
6 changes: 3 additions & 3 deletions src/vt/trace/trace_lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ struct TraceLite {
* \note See \c TraceScopedNote for a safer scope-based logging mechanism for
* bracketed user events with a note.
*
* \param[in] note the note to log
* \param[in] event the event ID
* \param[in] note the note to log
*/
void addUserNoteBracketedBeginTime(
std::string const& note, TraceEventIDType const event = no_trace_event
TraceEventIDType const event, std::string const& note
);

/**
Expand All @@ -203,7 +203,7 @@ struct TraceLite {
*
* \param[in] event the event ID
*/
void addUserNoteBracketedEndTime(TraceEventIDType const event = no_trace_event);
void addUserNoteBracketedEndTime(TraceEventIDType const event);

/**
* \brief Log a user bracketed event with a note
Expand Down
2 changes: 1 addition & 1 deletion src/vt/trace/trace_user.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void addUserNotePre(
) {
#if vt_check_enabled(trace_enabled)
if (in_event != no_user_event_id) {
theTrace()->addUserNoteBracketedBeginTime(in_note, in_event);
theTrace()->addUserNoteBracketedBeginTime(in_event, in_note);
}
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions src/vt/trace/trace_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ struct TraceScopedNote final {
note_(in_note)
{
if (event_ != no_trace_event) {
theTrace()->addUserNoteBracketedBeginTime(note_, event_);
theTrace()->addUserNoteBracketedBeginTime(event_, note_);
}
}

Expand All @@ -273,7 +273,7 @@ struct TraceScopedNote final {
note_("")
{
if (event_ != no_trace_event) {
theTrace()->addUserNoteBracketedBeginTime(note_, event_);
theTrace()->addUserNoteBracketedBeginTime(event_, note_);
}
}

Expand Down
16 changes: 8 additions & 8 deletions tests/unit/trace/test_trace_user.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,10 @@ TEST_F(TestTraceUser, trace_user_note_bracketed) {
GTEST_SKIP() << "trace tests require --vt_trace to be set";
}

theTrace()->addUserNoteBracketedBeginTime("OUTER TEST NOTE 10", 10);
theTrace()->addUserNoteBracketedBeginTime("INNER TEST NOTE 10", 10);
theTrace()->addUserNoteBracketedBeginTime("INNER INNER TEST NOTE 10", 10);
theTrace()->addUserNoteBracketedBeginTime("INNER INNER INNER TEST NOTE 12", 12);
theTrace()->addUserNoteBracketedBeginTime(10, "OUTER TEST NOTE 10");
theTrace()->addUserNoteBracketedBeginTime(10, "INNER TEST NOTE 10");
theTrace()->addUserNoteBracketedBeginTime(10, "INNER INNER TEST NOTE 10");
theTrace()->addUserNoteBracketedBeginTime(12, "INNER INNER INNER TEST NOTE 12");

theTrace()->addUserEvent(901);
trace::addUserNote("Note 0");
Expand All @@ -331,10 +331,10 @@ TEST_F(TestTraceUser, trace_user_note_bracketed_override_note) {
GTEST_SKIP() << "trace tests require --vt_trace to be set";
}

theTrace()->addUserNoteBracketedBeginTime("ABC", 10);
theTrace()->addUserNoteBracketedBeginTime("123", 10);
theTrace()->addUserNoteBracketedBeginTime("X", 10);
theTrace()->addUserNoteBracketedBeginTime("", 12);
theTrace()->addUserNoteBracketedBeginTime(10, "ABC");
theTrace()->addUserNoteBracketedBeginTime(10, "123");
theTrace()->addUserNoteBracketedBeginTime(10, "X");
theTrace()->addUserNoteBracketedBeginTime(12, "");

theTrace()->addUserEvent(901);
trace::addUserNote("Note 0");
Expand Down

0 comments on commit 03e7a8d

Please sign in to comment.