Skip to content
Open
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
4 changes: 2 additions & 2 deletions include/dfmodules/DataStore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <vector>

#ifndef EXTERN_C_FUNC_DECLARE_START
// NOLINTNEXTLINE(build/define_used)
// NOLINTNEXTLINE
#define EXTERN_C_FUNC_DECLARE_START \
extern "C" \
{
Expand All @@ -42,7 +42,7 @@
* @brief Declare the function that will be called by the plugin loader
* @param klass Class to be defined as a DUNE IPM Receiver
*/
// NOLINTNEXTLINE(build/define_used)
// NOLINTNEXTLINE
#define DEFINE_DUNE_DATA_STORE(klass) \
EXTERN_C_FUNC_DECLARE_START \
std::shared_ptr<dunedaq::dfmodules::DataStore> make(const std::string& name, \
Expand Down
10 changes: 5 additions & 5 deletions include/dfmodules/FileDataStoreImpl.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/**
* @file FileDataStoreImpl.hpp
*
* This is part of the DUNE DAQ Application Framework, copyright 2020.
* Licensing/copyright details are in the COPYING file that you should have
* received with this code.
*
* The base class for file-output-focused implementations of the
* DataStore interface
*
Expand All @@ -24,10 +28,6 @@
* from appmodel::DataStoreConf as a superclass and adds parameters as
* needed. See DataStoreConfTestDeriv in this package, and how it's
* used by SummaryTextDataStore
*
* This is part of the DUNE DAQ Application Framework, copyright 2020.
* Licensing/copyright details are in the COPYING file that you should have
* received with this code.
*/

#ifndef DFMODULES_INCLUDE_DFMODULES_FILEDATASTOREIMPL_HPP_
Expand Down Expand Up @@ -126,7 +126,7 @@ concept FileHandleConcept = requires(T file_handle,
{ const_file_handle.get_recorded_size() } -> std::convertible_to<size_t>;
{ const_file_handle.get_uncompressed_raw_data_size() } -> std::convertible_to<size_t>;
{ const_file_handle.get_total_file_size() } -> std::convertible_to<size_t>;
};
}; // NOLINT

/**
* @brief FileDataStoreImpl contains functionality you'd generally
Expand Down
13 changes: 7 additions & 6 deletions plugins/DFOModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ DFOModule::do_start(const CommandData_t& payload)
bool is_ready = m_busy_sender->is_ready_for_sending(std::chrono::milliseconds(100));
TLOG_DEBUG(0) << "The sender for TriggerInhibit messages " << (is_ready ? "is" : "is not") << " ready.";
}
for (auto trb_conn : m_trb_conn_ids) {
for (auto const& trb_conn : m_trb_conn_ids) {
auto sender = iom->get_sender<dfmessages::TriggerDecision>(trb_conn);
if (sender != nullptr) {
bool is_ready = sender->is_ready_for_sending(std::chrono::milliseconds(100));
Expand Down Expand Up @@ -227,7 +227,7 @@ DFOModule::receive_trigger_decision(const dfmessages::TriggerDecision& decision)
++m_received_decisions;
auto trigger_types = unpack_types(decision.trigger_type);
for (const auto t : trigger_types) {
++get_trigger_counter(t).received;
++(get_trigger_counter(t).received);
}

std::chrono::steady_clock::time_point decision_assigned;
Expand Down Expand Up @@ -405,7 +405,7 @@ DFOModule::receive_trigger_complete_token(const dfmessages::TriggerDecisionToken
auto dec_ptr = app_it->second->complete_assignment(token.trigger_number, m_metadata_function);
auto trigger_types = unpack_types(dec_ptr->decision.trigger_type);
for (const auto t : trigger_types)
++get_trigger_counter(t).completed;
++(get_trigger_counter(t).completed);
} catch (AssignedTriggerDecisionNotFound const& err) {
ers::error(err);
}
Expand Down Expand Up @@ -473,7 +473,7 @@ DFOModule::notify_trigger_if_needed() const
do {
try {
dfmessages::TriggerInhibit message{ busy, m_run_number };
m_busy_sender->send(std::move(message), m_queue_timeout);
m_busy_sender->send(std::move(message), m_queue_timeout); // NOLINT(performance-move-const-arg)
wasSentSuccessfully = true;
TLOG_DEBUG(TLVL_NOTIFY_TRIGGER) << get_name() << " Sent BUSY status " << busy << " to trigger in run "
<< m_run_number;
Expand Down Expand Up @@ -507,8 +507,9 @@ DFOModule::dispatch(const std::shared_ptr<AssignedTriggerDecision>& assignment)
wasSentSuccessfully = true;
++m_sent_decisions;
TLOG_DEBUG(TLVL_DISPATCH_TO_TRB) << get_name() << " Sent TriggerDecision for trigger_number "
<< decision_copy.trigger_number << " to TRB at connection "
<< assignment->connection_name << " for run number " << decision_copy.run_number;
<< assignment->decision.trigger_number << " to TRB at connection "
<< assignment->connection_name << " for run number "
<< assignment->decision.run_number;
} catch (const ers::Issue& excpt) {
std::ostringstream oss_warn;
oss_warn << "Send to connection \"" << assignment->connection_name << "\" failed";
Expand Down
18 changes: 10 additions & 8 deletions plugins/DFOModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* received with this code.
*/

#ifndef DFMODULES_PLUGINS_DATAFLOWORCHESTRATOR_HPP_
#define DFMODULES_PLUGINS_DATAFLOWORCHESTRATOR_HPP_
#ifndef DFMODULES_PLUGINS_DFOMODULE_HPP_
#define DFMODULES_PLUGINS_DFOMODULE_HPP_

#include "dfmodules/TriggerRecordBuilderData.hpp"

Expand All @@ -28,6 +28,7 @@
#include <map>
#include <memory>
#include <mutex>
#include <set>
#include <string>
#include <utility>
#include <vector>
Expand All @@ -48,8 +49,9 @@ ERS_DECLARE_ISSUE(dfmodules,
"DFOModule encountered run number mismatch: recvd (" << received_run_number << ") != " << run_number
<< " from " << src_app << " for trigger_number "
<< trig_num,
((uint32_t)received_run_number)((uint32_t)run_number)((std::string)src_app)(
(uint32_t)trig_num)) // NOLINT(build/unsigned)
((uint32_t)received_run_number) // NOLINT(build/unsigned)
((uint32_t)run_number) // NOLINT(build/unsigned)
((std::string)src_app)((uint32_t)trig_num)) // NOLINT(build/unsigned)
ERS_DECLARE_ISSUE(dfmodules,
IncompleteTriggerDecision,
"TriggerDecision " << trigger_number << " didn't complete within timeout in run " << run_number,
Expand Down Expand Up @@ -140,8 +142,8 @@ class DFOModule : public dunedaq::appfwk::DAQModule
// Struct for statistic
struct TriggerData
{
std::atomic<uint64_t> received{ 0 };
std::atomic<uint64_t> completed{ 0 };
std::atomic<uint64_t> received{ 0 }; // NOLINT(build/unsigned)
std::atomic<uint64_t> completed{ 0 }; // NOLINT(build/unsigned)
};
static std::set<trgdataformats::TriggerCandidateData::Type> unpack_types(
decltype(dfmessages::TriggerDecision::trigger_type) t)
Expand All @@ -152,7 +154,7 @@ class DFOModule : public dunedaq::appfwk::DAQModule
const std::bitset<64> bits(t);
for (size_t i = 0; i < bits.size(); ++i) {
if (bits[i])
results.insert((trgdataformats::TriggerCandidateData::Type)i);
results.insert(static_cast<trgdataformats::TriggerCandidateData::Type>(i));
}
return results;
}
Expand Down Expand Up @@ -181,4 +183,4 @@ class DFOModule : public dunedaq::appfwk::DAQModule
} // namespace dfmodules
} // namespace dunedaq

#endif // DFMODULES_PLUGINS_DATAFLOWORCHESTRATOR_HPP_
#endif // DFMODULES_PLUGINS_DFOMODULE_HPP_
39 changes: 19 additions & 20 deletions plugins/DataWriterModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ enum
TLVL_FRAGMENT_HEADER_DUMP = 17
};

namespace dunedaq {
namespace dfmodules {
namespace dunedaq::dfmodules {

DataWriterModule::DataWriterModule(const std::string& name)
: dunedaq::appfwk::DAQModule(name)
Expand Down Expand Up @@ -172,7 +171,7 @@ DataWriterModule::do_conf(const CommandData_t&)
}

// ensure that we have a valid dataWriter instance
if (m_data_writer.get() == nullptr) {
if (m_data_writer == nullptr) {
throw InvalidDataWriterModule(ERS_HERE, get_name());
}

Expand All @@ -188,14 +187,15 @@ DataWriterModule::do_start(const CommandData_t& payload)
m_data_storage_is_enabled = (!start_params.disable_data_storage);
m_run_number = start_params.run;

TLOG_DEBUG(TLVL_WORK_STEPS) << get_name() << ": Sending initial TriggerDecisionToken to DFO to announce my presence";
dfmessages::TriggerDecisionToken token;
token.run_number = 0;
token.trigger_number = 0;
token.decision_destination = m_trigger_decision_connection;

int wasSentSuccessfully = 5;
do {
TLOG_DEBUG(TLVL_WORK_STEPS) << get_name()
<< ": Sending initial TriggerDecisionToken to DFO to announce my presence";
dfmessages::TriggerDecisionToken token;
token.run_number = 0;
token.trigger_number = 0;
token.decision_destination = m_trigger_decision_connection;

try {
m_token_output->send(std::move(token), m_queue_timeout);
wasSentSuccessfully = 0;
Expand All @@ -215,7 +215,7 @@ DataWriterModule::do_start(const CommandData_t& payload)
if (m_data_storage_is_enabled) {

// ensure that we have a valid dataWriter instance
if (m_data_writer.get() == nullptr) {
if (m_data_writer == nullptr) {
// this check is done essentially to notify the user
// in case the "start" has been called before the "conf"
ers::fatal(InvalidDataWriterModule(ERS_HERE, get_name()));
Expand Down Expand Up @@ -377,16 +377,16 @@ DataWriterModule::receive_trigger_record(std::unique_ptr<daqdataformats::Trigger
}
}
if (send_trigger_complete_message) {
TLOG_DEBUG(TLVL_WORK_STEPS) << get_name() << ": Pushing the TriggerDecisionToken for trigger number "
<< trigger_record_ptr->get_header_ref().get_trigger_number()
<< " onto the relevant output queue";
dfmessages::TriggerDecisionToken token;
token.run_number = m_run_number;
token.trigger_number = trigger_record_ptr->get_header_ref().get_trigger_number();
token.decision_destination = m_trigger_decision_connection;

bool wasSentSuccessfully = false;
do {
TLOG_DEBUG(TLVL_WORK_STEPS) << get_name() << ": Pushing the TriggerDecisionToken for trigger number "
<< trigger_record_ptr->get_header_ref().get_trigger_number()
<< " onto the relevant output queue";
dfmessages::TriggerDecisionToken token;
token.run_number = m_run_number;
token.trigger_number = trigger_record_ptr->get_header_ref().get_trigger_number();
token.decision_destination = m_trigger_decision_connection;

try {
m_token_output->send(std::move(token), m_queue_timeout);
wasSentSuccessfully = true;
Expand Down Expand Up @@ -418,7 +418,6 @@ DataWriterModule::do_work(std::atomic<bool>& running_flag)
}
}

} // namespace dfmodules
} // namespace dunedaq
} // namespace dunedaq::dfmodules

DEFINE_DUNE_DAQ_MODULE(dunedaq::dfmodules::DataWriterModule)
8 changes: 4 additions & 4 deletions plugins/DataWriterModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* received with this code.
*/

#ifndef DFMODULES_PLUGINS_DATAWRITER_HPP_
#define DFMODULES_PLUGINS_DATAWRITER_HPP_
#ifndef DFMODULES_PLUGINS_DATAWRITERMODULE_HPP_
#define DFMODULES_PLUGINS_DATAWRITERMODULE_HPP_

#include "dfmodules/DataStore.hpp"

Expand Down Expand Up @@ -104,7 +104,7 @@ class DataWriterModule : public dunedaq::appfwk::DAQModule
inline double elapsed_seconds(std::chrono::steady_clock::time_point then,
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now()) const
{
return std::chrono::duration_cast<std::chrono::seconds>(now - then).count();
return std::chrono::duration_cast<std::chrono::duration<double, std::ratio<1>>>(now - then).count();
}
};
} // namespace dfmodules
Expand Down Expand Up @@ -136,4 +136,4 @@ ERS_DECLARE_ISSUE_BASE(dfmodules,

} // namespace dunedaq

#endif // DFMODULES_PLUGINS_DATAWRITER_HPP_
#endif // DFMODULES_PLUGINS_DATAWRITERMODULE_HPP_
8 changes: 3 additions & 5 deletions plugins/FakeDataProdModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ enum
TLVL_TIME_SYNCS = 12
};

namespace dunedaq {
namespace dfmodules {
namespace dunedaq::dfmodules {

FakeDataProdModule::FakeDataProdModule(const std::string& name)
: dunedaq::appfwk::DAQModule(name)
Expand Down Expand Up @@ -155,7 +154,7 @@ FakeDataProdModule::do_timesync(std::atomic<bool>& running_flag)
<< " run=" << timesyncmsg.run_number << " seqno=" << timesyncmsg.sequence_number
<< " source_id=" << timesyncmsg.source_id;
try {
sender_ptr->send(std::move(timesyncmsg), std::chrono::milliseconds(500));
sender_ptr->send(std::move(timesyncmsg), std::chrono::milliseconds(500)); // NOLINT(performance-move-const-arg)
++sent_count;
} catch (ers::Issue& excpt) {
ers::warning(TimeSyncTransmissionFailed(ERS_HERE, get_name(), m_timesync_id, excpt));
Expand Down Expand Up @@ -215,7 +214,6 @@ FakeDataProdModule::process_data_request(dfmessages::DataRequest& data_request)
TLOG_DEBUG(TLVL_ENTER_EXIT_METHODS) << get_name() << ": finishing processing request " << data_request.request_number;
}

} // namespace dfmodules
} // namespace dunedaq
} // namespace dunedaq::dfmodules

DEFINE_DUNE_DAQ_MODULE(dunedaq::dfmodules::FakeDataProdModule)
6 changes: 3 additions & 3 deletions plugins/FakeDataProdModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* received with this code.
*/

#ifndef DFMODULES_PLUGINS_FAKEDATAPROD_HPP_
#define DFMODULES_PLUGINS_FAKEDATAPROD_HPP_
#ifndef DFMODULES_PLUGINS_FAKEDATAPRODMODULE_HPP_
#define DFMODULES_PLUGINS_FAKEDATAPRODMODULE_HPP_

#include "daqdataformats/Fragment.hpp"
#include "dfmessages/DataRequest.hpp"
Expand Down Expand Up @@ -99,4 +99,4 @@ class FakeDataProdModule : public dunedaq::appfwk::DAQModule
} // namespace dfmodules
} // namespace dunedaq

#endif // DFMODULES_PLUGINS_FAKEDATAPROD_HPP_
#endif // DFMODULES_PLUGINS_FAKEDATAPRODMODULE_HPP_
18 changes: 12 additions & 6 deletions plugins/FragmentAggregatorModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
#include "iomanager/IOManager.hpp"

#include <iostream>
#include <limits>
#include <memory>
#include <string>
#include <tuple>
#include <utility>

namespace dunedaq {
namespace dfmodules {
namespace dunedaq::dfmodules {

FragmentAggregatorModule::FragmentAggregatorModule(const std::string& name)
: DAQModule(name)
Expand Down Expand Up @@ -75,6 +78,7 @@ FragmentAggregatorModule::generate_opmon_data()
{
if (m_data_requests_processed > 0) {
opmon::FragmentAggregatorTimeInfo dr_times;
// NOLINTNEXTLINE(build/unsigned)
dr_times.set_min_us(m_data_requests_time_min_us.exchange(std::numeric_limits<uint64_t>::max()));
dr_times.set_max_us(m_data_requests_time_max_us.exchange(0));
dr_times.set_average_us(m_data_requests_time_average_us.exchange(0) / m_data_requests_processed);
Expand All @@ -83,6 +87,7 @@ FragmentAggregatorModule::generate_opmon_data()

if (m_fragments_processed > 0) {
opmon::FragmentAggregatorTimeInfo frag_times;
// NOLINTNEXTLINE(build/unsigned)
frag_times.set_min_us(m_fragments_time_min_us.exchange(std::numeric_limits<uint64_t>::max()));
frag_times.set_max_us(m_fragments_time_max_us.exchange(0));
frag_times.set_average_us(m_fragments_time_average_us.exchange(0) / m_fragments_processed);
Expand Down Expand Up @@ -119,9 +124,11 @@ FragmentAggregatorModule::do_start(const CommandData_t& /* args */)
m_fragments_incomplete.store(0);
m_fragments_invalid.store(0);
m_fragments_time_average_us.store(0);
// NOLINTNEXTLINE(build/unsigned)
m_fragments_time_min_us.store(std::numeric_limits<uint64_t>::max());
m_fragments_time_max_us.store(0);
m_data_requests_time_average_us.store(0);
// NOLINTNEXTLINE(build/unsigned)
m_data_requests_time_min_us.store(std::numeric_limits<uint64_t>::max());
m_data_requests_time_max_us.store(0);

Expand All @@ -132,7 +139,7 @@ FragmentAggregatorModule::do_start(const CommandData_t& /* args */)
// the first data-taking run in a DAQ session. Such delays can lead to undesirable
// system behavior like trigger inhibits.
auto iom = iomanager::IOManager::get();
for (auto trb_conn : m_trb_conn_ids) {
for (auto const& trb_conn : m_trb_conn_ids) {
auto sender = iom->get_sender<std::unique_ptr<daqdataformats::Fragment>>(trb_conn);
if (sender != nullptr) {
bool is_ready = sender->is_ready_for_sending(std::chrono::milliseconds(100));
Expand Down Expand Up @@ -265,14 +272,13 @@ FragmentAggregatorModule::process_fragment(std::unique_ptr<daqdataformats::Fragm
}
}

uint64_t
uint64_t // NOLINT(build/unsigned)
FragmentAggregatorModule::get_current_time_us()
{
return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now().time_since_epoch())
.count();
}

} // namespace dfmodules
} // namespace dunedaq
} // namespace dunedaq::dfmodules

DEFINE_DUNE_DAQ_MODULE(dunedaq::dfmodules::FragmentAggregatorModule)
Loading
Loading