Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly set the TRACE_NAME in TLOG calls in several hxx files #69

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions include/iomanager/detail/IOManager.hxx
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ IOManager::get_receiver(ConnectionId id)

if (!m_receivers.count(id)) {
if (QueueRegistry::get().has_queue(id.uid, id.data_type)) { // if queue
TLOG() << "Creating QueueReceiverModel for uid " << id.uid << ", datatype " << id.data_type;
TLOG("IOManager") << "Creating QueueReceiverModel for uid " << id.uid << ", datatype " << id.data_type;
m_receivers[id] = std::make_shared<QueueReceiverModel<Datatype>>(id);
} else {
TLOG() << "Creating NetworkReceiverModel for uid " << id.uid << ", datatype " << id.data_type << " in session "
<< id.session;
TLOG("IOManager") << "Creating NetworkReceiverModel for uid " << id.uid << ", datatype " << id.data_type
<< " in session " << id.session;
m_receivers[id] = std::make_shared<NetworkReceiverModel<Datatype>>(id);
}
}
Expand Down Expand Up @@ -98,11 +98,11 @@ IOManager::get_sender(ConnectionId id)

if (!m_senders.count(id)) {
if (QueueRegistry::get().has_queue(id.uid, id.data_type)) { // if queue
TLOG() << "Creating QueueSenderModel for uid " << id.uid << ", datatype " << id.data_type;
TLOG("IOManager") << "Creating QueueSenderModel for uid " << id.uid << ", datatype " << id.data_type;
m_senders[id] = std::make_shared<QueueSenderModel<Datatype>>(id);
} else {
TLOG() << "Creating NetworkSenderModel for uid " << id.uid << ", datatype " << id.data_type << " in session "
<< id.session;
TLOG("IOManager") << "Creating NetworkSenderModel for uid " << id.uid << ", datatype " << id.data_type
<< " in session " << id.session;
m_senders[id] = std::make_shared<NetworkSenderModel<Datatype>>(id);
}
}
Expand Down
24 changes: 14 additions & 10 deletions include/iomanager/network/detail/NetworkSenderModel.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ template<typename Datatype>
inline NetworkSenderModel<Datatype>::NetworkSenderModel(ConnectionId const& conn_id)
: SenderConcept<Datatype>(conn_id)
{
TLOG() << "NetworkSenderModel created with DT! Addr: " << static_cast<void*>(this)
<< ", uid=" << conn_id.uid << ", data_type=" << conn_id.data_type;
TLOG("NetworkSenderModel") << "NetworkSenderModel created with DT! Addr: " << static_cast<void*>(this)
<< ", uid=" << conn_id.uid << ", data_type=" << conn_id.data_type;
get_sender(std::chrono::milliseconds(1000));
if (m_network_sender_ptr == nullptr) {
TLOG() << "Initial connection attempt failed for uid=" << conn_id.uid << ", data_type=" << conn_id.data_type;
TLOG("NetworkSenderModel") << "Initial connection attempt failed for uid=" << conn_id.uid
<< ", data_type=" << conn_id.data_type;
}
}

Expand Down Expand Up @@ -82,7 +83,7 @@ NetworkSenderModel<Datatype>::get_sender(Sender::timeout_t const& timeout)
m_network_sender_ptr = NetworkManager::get().get_sender(this->id());

if (NetworkManager::get().is_pubsub_connection(this->id())) {
TLOG() << "Setting topic to " << this->id().data_type;
TLOG("NetworkSenderModel") << "Setting topic to " << this->id().data_type;
m_topic = this->id().data_type;
}
} catch (ers::Issue const& ex) {
Expand All @@ -105,13 +106,14 @@ NetworkSenderModel<Datatype>::write_network(MessageType& message, Sender::timeou
}

auto serialized = dunedaq::serialization::serialize(message, dunedaq::serialization::kMsgPack);
// TLOG() << "Serialized message for network sending: " << serialized.size() << ", topic=" << m_topic << ", this="
// TLOG("NetworkSenderModel") << "Serialized message for network sending: " << serialized.size() << ", topic=" <<
// m_topic << ", this="
// << (void*)this;

try {
m_network_sender_ptr->send(serialized.data(), serialized.size(), extend_first_timeout(timeout), m_topic);
} catch (ipm::SendTimeoutExpired const& ex) {
TLOG() << "Timeout detected, removing sender to re-acquire connection";
TLOG("NetworkSenderModel") << "Timeout detected, removing sender to re-acquire connection";
NetworkManager::get().remove_sender(this->id());
m_network_sender_ptr = nullptr;
throw;
Expand All @@ -134,18 +136,19 @@ NetworkSenderModel<Datatype>::try_write_network(MessageType& message, Sender::ti
std::lock_guard<std::mutex> lk(m_send_mutex);
get_sender(timeout);
if (m_network_sender_ptr == nullptr) {
TLOG() << ConnectionInstanceNotFound(ERS_HERE, this->id().uid);
TLOG("NetworkSenderModel") << ConnectionInstanceNotFound(ERS_HERE, this->id().uid);
return false;
}

auto serialized = dunedaq::serialization::serialize(message, dunedaq::serialization::kMsgPack);
// TLOG() << "Serialized message for network sending: " << serialized.size() << ", topic=" << m_topic <<
// TLOG("NetworkSenderModel") << "Serialized message for network sending: " << serialized.size() << ", topic=" <<
// m_topic <<
// ", this=" << (void*)this;

auto res =
m_network_sender_ptr->send(serialized.data(), serialized.size(), extend_first_timeout(timeout), m_topic, true);
if (!res) {
TLOG() << "Timeout detected, removing sender to re-acquire connection";
TLOG("NetworkSenderModel") << "Timeout detected, removing sender to re-acquire connection";
NetworkManager::get().remove_sender(this->id());
m_network_sender_ptr = nullptr;
}
Expand Down Expand Up @@ -176,7 +179,8 @@ NetworkSenderModel<Datatype>::write_network_with_topic(MessageType& message,
}

auto serialized = dunedaq::serialization::serialize(message, dunedaq::serialization::kMsgPack);
// TLOG() << "Serialized message for network sending: " << serialized.size() << ", topic=" << m_topic << ", this="
// TLOG("NetworkSenderModel") << "Serialized message for network sending: " << serialized.size() << ", topic=" <<
// m_topic << ", this="
// << (void*)this;

try {
Expand Down
4 changes: 2 additions & 2 deletions include/iomanager/queue/detail/QueueSenderModel.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ template<typename Datatype>
inline QueueSenderModel<Datatype>::QueueSenderModel(ConnectionId const& request)
: SenderConcept<Datatype>(request)
{
TLOG() << "QueueSenderModel created with DT! Addr: " << static_cast<void*>(this);
TLOG("QueueSenderModel") << "QueueSenderModel created with DT! Addr: " << static_cast<void*>(this);
m_queue = QueueRegistry::get().get_queue<Datatype>(request.uid);
TLOG() << "QueueSenderModel m_queue=" << static_cast<void*>(m_queue.get());
TLOG("QueueSenderModel") << "QueueSenderModel m_queue=" << static_cast<void*>(m_queue.get());
// get queue ref from queueregistry based on conn_id
}

Expand Down