From df61780c9056ec09578509ae86fe836243a3c698 Mon Sep 17 00:00:00 2001 From: Arkadiusz Szczepkowicz Date: Wed, 24 Aug 2022 13:05:03 +0200 Subject: [PATCH] #1899: Don't add trace context when tracing is disabled --- src/vt/runnable/make_runnable.h | 4 ++++ src/vt/vrt/collection/manager.impl.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/vt/runnable/make_runnable.h b/src/vt/runnable/make_runnable.h index e92a6c3ae2..fbd25e2c6d 100644 --- a/src/vt/runnable/make_runnable.h +++ b/src/vt/runnable/make_runnable.h @@ -211,6 +211,7 @@ struct RunnableMaker { return std::move(*this); } +#if vt_check_enabled(trace_enabled) /** * \brief Add a trace index (for collection elements) * @@ -229,6 +230,7 @@ struct RunnableMaker { ); return std::move(*this); } +#endif /** * \brief Add a tag to the handler @@ -317,12 +319,14 @@ RunnableMaker makeRunnable( MsgSharedPtr const& msg, bool is_threaded, HandlerType handler, NodeType from ) { auto r = std::make_unique(msg, is_threaded); +#if vt_check_enabled(trace_enabled) auto const han_type = HandlerManager::getHandlerRegistryType(handler); if (han_type == auto_registry::RegistryTypeEnum::RegVrt or han_type == auto_registry::RegistryTypeEnum::RegGeneral or han_type == auto_registry::RegistryTypeEnum::RegObjGroup) { r->template addContext(msg, handler, from); } +#endif r->template addContext(r.get(), from); return RunnableMaker{std::move(r), msg, handler, from}; } diff --git a/src/vt/vrt/collection/manager.impl.h b/src/vt/vrt/collection/manager.impl.h index ca2af41855..65eb1f789d 100644 --- a/src/vt/vrt/collection/manager.impl.h +++ b/src/vt/vrt/collection/manager.impl.h @@ -211,6 +211,7 @@ CollectionManager::collectionAutoMsgDeliver( ) { auto user_msg = makeMessage(std::move(msg->getMsg())); +#if vt_check_enabled(trace_enabled) // Expand out the index for tracing purposes; Projections takes up to // 4-dimensions auto idx = base->getIndex(); @@ -218,11 +219,14 @@ CollectionManager::collectionAutoMsgDeliver( uint64_t const idx2 = idx.ndims() > 1 ? idx[1] : 0; uint64_t const idx3 = idx.ndims() > 2 ? idx[2] : 0; uint64_t const idx4 = idx.ndims() > 3 ? idx[3] : 0; +#endif runnable::makeRunnable(user_msg, true, han, from) .withTDEpoch(theMsg()->getEpochContextMsg(msg)) .withCollection(base) +#if vt_check_enabled(trace_enabled) .withTraceIndex(event, idx1, idx2, idx3, idx4) +#endif .withLBData(base, msg) .runOrEnqueue(immediate); } @@ -233,6 +237,7 @@ CollectionManager::collectionAutoMsgDeliver( MsgT* msg, Indexable* base, HandlerType han, NodeType from, trace::TraceEventIDType event, bool immediate ) { +#if vt_check_enabled(trace_enabled) // Expand out the index for tracing purposes; Projections takes up to // 4-dimensions auto idx = base->getIndex(); @@ -240,12 +245,15 @@ CollectionManager::collectionAutoMsgDeliver( uint64_t const idx2 = idx.ndims() > 1 ? idx[1] : 0; uint64_t const idx3 = idx.ndims() > 2 ? idx[2] : 0; uint64_t const idx4 = idx.ndims() > 3 ? idx[3] : 0; +#endif auto m = promoteMsg(msg); runnable::makeRunnable(m, true, han, from) .withTDEpoch(theMsg()->getEpochContextMsg(msg)) .withCollection(base) +#if vt_check_enabled(trace_enabled) .withTraceIndex(event, idx1, idx2, idx3, idx4) +#endif .withLBData(base) .runOrEnqueue(immediate); }