From 68299809d9e7c5221eb197be73429aae4263756c Mon Sep 17 00:00:00 2001 From: Eric Flumerfelt Date: Thu, 24 Sep 2026 15:52:33 -0500 Subject: [PATCH 1/3] Apply clang-format --- include/dfmodules/DataStore.hpp | 18 +- include/dfmodules/FileDataStoreImpl.hpp | 161 ++++++++---------- .../dfmodules/detail/FileDataStoreImpl.hxx | 108 ++++++------ plugins/DFOModule.cpp | 41 +++-- plugins/DFOModule.hpp | 47 ++--- plugins/FragmentAggregatorModule.cpp | 2 +- plugins/FragmentAggregatorModule.hpp | 19 +-- plugins/HDF5DataStore.cpp | 8 +- plugins/HDF5DataStore.hpp | 72 ++++---- plugins/SummaryTextDataStore.cpp | 8 +- plugins/SummaryTextDataStore.hpp | 69 ++++---- plugins/TRBModule.cpp | 14 +- plugins/TRBModule.hpp | 45 ++--- plugins/TRMonRequestorModule.hpp | 16 +- src/SummaryTextDataWriter.cpp | 1 - src/TPBundleHandler.cpp | 17 +- src/TriggerInhibitAgent.cpp | 3 +- src/TriggerRecordBuilderData.cpp | 34 ++-- src/dfmodules/SummaryTextDataWriter.hpp | 10 +- src/dfmodules/TPBundleHandler.hpp | 13 +- src/dfmodules/TriggerInhibitAgent.hpp | 10 +- src/dfmodules/TriggerRecordBuilderData.hpp | 15 +- unittest/DataStoreFactory_test.cxx | 1 - unittest/HDF5Write_test.cxx | 20 +-- unittest/SummaryTextWrite_test.cxx | 26 +-- unittest/TriggerRecordBuilderData_test.cxx | 11 +- 26 files changed, 392 insertions(+), 397 deletions(-) mode change 100755 => 100644 plugins/TRMonRequestorModule.hpp diff --git a/include/dfmodules/DataStore.hpp b/include/dfmodules/DataStore.hpp index 3ceccce4..ebe6ee8a 100644 --- a/include/dfmodules/DataStore.hpp +++ b/include/dfmodules/DataStore.hpp @@ -15,13 +15,13 @@ #define DFMODULES_INCLUDE_DFMODULES_DATASTORE_HPP_ #include "appfwk/ConfigurationManager.hpp" -#include "opmonlib/MonitorableObject.hpp" #include "cetlib/BasicPluginFactory.h" #include "cetlib/compiler_macros.h" #include "daqdataformats/TimeSlice.hpp" #include "daqdataformats/TriggerRecord.hpp" #include "daqdataformats/Types.hpp" #include "logging/Logging.hpp" // NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG< make(const std::string& name, \ - std::shared_ptr mcfg, \ - const std::string& writer_name ) \ + std::shared_ptr mcfg, \ + const std::string& writer_name) \ { \ return std::shared_ptr(new klass(name, mcfg, writer_name)); \ } \ @@ -93,7 +93,9 @@ namespace dfmodules { /** * @brief comment */ -class DataStore : public utilities::NamedObject, public opmonlib::MonitorableObject +class DataStore + : public utilities::NamedObject + , public opmonlib::MonitorableObject { public: /** @@ -101,7 +103,8 @@ class DataStore : public utilities::NamedObject, public opmonlib::MonitorableObj * @param name Name of the DataStore instance */ explicit DataStore(const std::string& name) - : utilities::NamedObject(name), MonitorableObject() + : utilities::NamedObject(name) + , MonitorableObject() { } @@ -126,8 +129,7 @@ class DataStore : public utilities::NamedObject, public opmonlib::MonitorableObj * This allows DataStore instances to make any preparations that will be * beneficial in advance of the first data blocks being written or read. */ - virtual void prepare_for_run(daqdataformats::run_number_t run_number, - bool run_is_for_test_purposes) = 0; + virtual void prepare_for_run(daqdataformats::run_number_t run_number, bool run_is_for_test_purposes) = 0; /** * @brief Informs the DataStore that writes or reads of data blocks associated @@ -155,7 +157,7 @@ inline std::shared_ptr make_data_store(const std::string& type, const std::string& name, std::shared_ptr mcfg, - const std::string& writer_identifier) + const std::string& writer_identifier) { static cet::BasicPluginFactory bpf("duneDataStore", "make"); // NOLINT diff --git a/include/dfmodules/FileDataStoreImpl.hpp b/include/dfmodules/FileDataStoreImpl.hpp index f0954973..c4d45c62 100644 --- a/include/dfmodules/FileDataStoreImpl.hpp +++ b/include/dfmodules/FileDataStoreImpl.hpp @@ -68,9 +68,8 @@ ERS_DECLARE_ISSUE_BASE(dfmodules, FileDataStoreImplBadConfiguration, appfwk::GeneralDAQModuleIssue, "Construction of the FileDataStoreImpl base class failed due to faulty configuration", - ((std::string)name), - ) - + ((std::string)name), ) + ERS_DECLARE_ISSUE_BASE(dfmodules, InvalidOperationMode, appfwk::GeneralDAQModuleIssue, @@ -104,11 +103,11 @@ ERS_DECLARE_ISSUE_BASE(dfmodules, ((std::string)path)((size_t)free_bytes)((size_t)needed_bytes)((std::string)criteria)) ERS_DECLARE_ISSUE_BASE(dfmodules, - TimeSliceAlreadyExists, - appfwk::GeneralDAQModuleIssue, - "The TimeSlice record for timeslice #" << timeslice_number << " already exists.", - ((std::string)name), - ((daqdataformats::timeslice_number_t)timeslice_number)) + TimeSliceAlreadyExists, + appfwk::GeneralDAQModuleIssue, + "The TimeSlice record for timeslice #" << timeslice_number << " already exists.", + ((std::string)name), + ((daqdataformats::timeslice_number_t)timeslice_number)) // Re-enable coverage checking LCOV_EXCL_STOP namespace dfmodules { @@ -118,8 +117,7 @@ template concept FileHandleConcept = requires(T file_handle, const T const_file_handle, const daqdataformats::TriggerRecord& tr, - const daqdataformats::TimeSlice& ts) -{ + const daqdataformats::TimeSlice& ts) { { file_handle.write(tr) } -> std::same_as; { file_handle.write(ts) } -> std::same_as; { file_handle.timeslice_already_exists(ts) } -> std::convertible_to; @@ -135,7 +133,7 @@ concept FileHandleConcept = requires(T file_handle, * want in a data store which writes to a file irrespective of file * type. See top of this header file for details. */ -template // E.g., SummaryTextDataWriter +template // E.g., SummaryTextDataWriter class FileDataStoreImpl : public DataStore { @@ -145,7 +143,7 @@ class FileDataStoreImpl : public DataStore TLVL_BASIC = 2 }; - static constexpr size_t s_unset_record_number { std::numeric_limits::max() }; + static constexpr size_t s_unset_record_number{ std::numeric_limits::max() }; /** * @brief FileDataStoreImpl Constructor @@ -153,32 +151,35 @@ class FileDataStoreImpl : public DataStore * */ explicit FileDataStoreImpl(std::string const& name, - std::shared_ptr mcfg, - std::string const& writer_name) + std::shared_ptr mcfg, + std::string const& writer_name) : DataStore(name) - , m_file_handle {nullptr} - , m_run_number {0} - , m_file_index {0} - , m_writer_identifier {writer_name} - , m_config_params { mcfg ? mcfg->get_dal(name) : nullptr } - , m_session { mcfg ? mcfg->get_session() : nullptr } - , m_compression_level { m_config_params ? m_config_params->get_compression_level() : static_cast(0) } // NOLINT(build/unsigned) - , m_operational_environment { m_session ? m_session->get_detector_configuration()->get_op_env() : "unavailable" } - , m_offline_data_stream { m_session ? m_session->get_detector_configuration()->get_offline_data_stream() : "unavailable" } - , m_run_is_for_test_purposes { false } - , m_basic_name_of_open_file {""} - , m_recorded_size {0} - , m_uncompressed_raw_data_size {0} - , m_previous_file_size {0} - , m_total_file_size {0} - , m_current_record_number {s_unset_record_number} - , m_new_bytes {0} - , m_new_objects {0} - , m_operation_mode { m_config_params ? m_config_params->get_mode() : "unavailable" } - , m_path {m_config_params ? m_config_params->get_directory_path() : "unavailable" } - , m_max_file_size {m_config_params ? m_config_params->get_max_file_size() : std::numeric_limits::max() } - , m_disable_unique_suffix { m_config_params ? m_config_params->get_disable_unique_filename_suffix() : false } - , m_free_space_safety_factor_for_write {m_config_params ? m_config_params->get_free_space_safety_factor() : std::numeric_limits::max() } + , m_file_handle{ nullptr } + , m_run_number{ 0 } + , m_file_index{ 0 } + , m_writer_identifier{ writer_name } + , m_config_params{ mcfg ? mcfg->get_dal(name) : nullptr } + , m_session{ mcfg ? mcfg->get_session() : nullptr } + , m_compression_level{ m_config_params ? m_config_params->get_compression_level() : static_cast(0) } + // NOLINT(build/unsigned) + , m_operational_environment{ m_session ? m_session->get_detector_configuration()->get_op_env() : "unavailable" } + , m_offline_data_stream{ m_session ? m_session->get_detector_configuration()->get_offline_data_stream() + : "unavailable" } + , m_run_is_for_test_purposes{ false } + , m_basic_name_of_open_file{ "" } + , m_recorded_size{ 0 } + , m_uncompressed_raw_data_size{ 0 } + , m_previous_file_size{ 0 } + , m_total_file_size{ 0 } + , m_current_record_number{ s_unset_record_number } + , m_new_bytes{ 0 } + , m_new_objects{ 0 } + , m_operation_mode{ m_config_params ? m_config_params->get_mode() : "unavailable" } + , m_path{ m_config_params ? m_config_params->get_directory_path() : "unavailable" } + , m_max_file_size{ m_config_params ? m_config_params->get_max_file_size() : std::numeric_limits::max() } + , m_disable_unique_suffix{ m_config_params ? m_config_params->get_disable_unique_filename_suffix() : false } + , m_free_space_safety_factor_for_write{ m_config_params ? m_config_params->get_free_space_safety_factor() + : std::numeric_limits::max() } { TLOG_DEBUG(TLVL_BASIC) << get_name(); @@ -186,8 +187,7 @@ class FileDataStoreImpl : public DataStore throw FileDataStoreImplBadConfiguration(ERS_HERE, get_name()); } - if (m_operation_mode != "one-event-per-file" - && m_operation_mode != "all-per-file") { + if (m_operation_mode != "one-event-per-file" && m_operation_mode != "all-per-file") { throw InvalidOperationMode(ERS_HERE, get_name(), m_operation_mode); } @@ -205,48 +205,31 @@ class FileDataStoreImpl : public DataStore // Getter functions which can be used by the implementation of open_new_file - std::string get_application_name() const noexcept { - return m_writer_identifier; - } + std::string get_application_name() const noexcept { return m_writer_identifier; } - unsigned get_compression_level() const noexcept { // NOLINT(build/unsigned) + unsigned get_compression_level() const noexcept + { // NOLINT(build/unsigned) return m_compression_level; } - const appmodel::DataStoreConf& get_configuration() const noexcept { - return *m_config_params; - } + const appmodel::DataStoreConf& get_configuration() const noexcept { return *m_config_params; } - auto& get_file_handle() { - return m_file_handle; - } + auto& get_file_handle() { return m_file_handle; } - size_t get_file_index() const noexcept { - return m_file_index.load(); - } + size_t get_file_index() const noexcept { return m_file_index.load(); } - const std::string& get_offline_data_stream() const noexcept { - return m_offline_data_stream; - } + const std::string& get_offline_data_stream() const noexcept { return m_offline_data_stream; } - const std::string& get_operational_environment() const noexcept { - return m_operational_environment; - } + const std::string& get_operational_environment() const noexcept { return m_operational_environment; } - bool get_run_is_for_test_purposes() const noexcept { - return m_run_is_for_test_purposes; - } + bool get_run_is_for_test_purposes() const noexcept { return m_run_is_for_test_purposes; } - daqdataformats::run_number_t get_run_number() const noexcept { - return m_run_number; - } + daqdataformats::run_number_t get_run_number() const noexcept { return m_run_number; } - const confmodel::Session& get_session() const noexcept { - return *m_session; - } + const confmodel::Session& get_session() const noexcept { return *m_session; } /** - * @brief FileDataStoreImpl write() + * @brief FileDataStoreImpl write() * Method used to write TriggerRecords into the data * file. Operational mode defined in the configuration file. * @@ -314,7 +297,7 @@ class FileDataStoreImpl : public DataStore try { if (m_file_handle->timeslice_already_exists(ts)) { - throw TimeSliceAlreadyExists(ERS_HERE, get_name(), ts.get_header().timeslice_number); + throw TimeSliceAlreadyExists(ERS_HERE, get_name(), ts.get_header().timeslice_number); } m_file_handle->write(ts); @@ -341,8 +324,7 @@ class FileDataStoreImpl : public DataStore * * This method may throw an exception if it finds a problem. */ - void prepare_for_run(daqdataformats::run_number_t run_number, - bool run_is_for_test_purposes) override + void prepare_for_run(daqdataformats::run_number_t run_number, bool run_is_for_test_purposes) override { m_run_number = run_number; m_run_is_for_test_purposes = run_is_for_test_purposes; @@ -400,7 +382,7 @@ class FileDataStoreImpl : public DataStore FileDataStoreImpl& operator=(const FileDataStoreImpl&) = delete; FileDataStoreImpl(FileDataStoreImpl&&) = delete; FileDataStoreImpl& operator=(FileDataStoreImpl&&) = delete; - + protected: void generate_opmon_data() override { @@ -414,25 +396,28 @@ class FileDataStoreImpl : public DataStore } private: - // Translates various available parameters (directory path, file extension, etc.) into the appropriate filename. std::string get_file_name(daqdataformats::run_number_t run_number) const; - // Throws a RetryableDataStoreProblem if (size of the object)*(free space safety factor) exceeds available space in m_path + // Throws a RetryableDataStoreProblem if (size of the object)*(free space safety factor) exceeds available space in + // m_path void throw_if_insufficient_space_for_object(size_t obj_size, const std::string& obj_name) const; // Available space in the path whose name is passed to get_free_space size_t get_free_space(const std::string& the_path) const; - + // Check if a new file should be opened for the record and increment m_file_index if so - void increment_file_index_if_needed(const size_t size_of_object_to_write, const size_t object_record_number, const size_t current_record_number) + void increment_file_index_if_needed(const size_t size_of_object_to_write, + const size_t object_record_number, + const size_t current_record_number) { - float compression_factor {1.0}; + float compression_factor{ 1.0 }; if (m_compression_level != 0 && m_recorded_size != 0) { // Without compression, the uncompressed raw data size is approximately the total file size, so it // serves as an approximation of what would have been written without compression - compression_factor = static_cast(m_file_handle->get_uncompressed_raw_data_size()) / m_file_handle->get_total_file_size(); + compression_factor = + static_cast(m_file_handle->get_uncompressed_raw_data_size()) / m_file_handle->get_total_file_size(); } float size_of_next_write = size_of_object_to_write / compression_factor; @@ -446,9 +431,8 @@ class FileDataStoreImpl : public DataStore } // JCF, 06-27-2026: TODO: probably need to reset m_recorded_size, etc., as is done right above - if (m_operation_mode == "one-event-per-file" && - current_record_number != s_unset_record_number && - current_record_number != object_record_number) { + if (m_operation_mode == "one-event-per-file" && current_record_number != s_unset_record_number && + current_record_number != object_record_number) { ++m_file_index; return; } @@ -481,12 +465,14 @@ class FileDataStoreImpl : public DataStore // (determined inside the HDF5RawDataFile constructor) could disagree. std::string unique_filename = file_name; if (!m_disable_unique_suffix) { - time_t now { time(nullptr) }; - std::string file_creation_timestamp = boost::posix_time::to_iso_string(boost::posix_time::from_time_t(now)); + time_t now{ time(nullptr) }; + std::string file_creation_timestamp = boost::posix_time::to_iso_string(boost::posix_time::from_time_t(now)); // timestamp substring size_t ufn_len = unique_filename.length(); - size_t extension_length = m_file_handle->get_file_name_extension().size() + 1; // + 1 for the "." before the extension - if (ufn_len > extension_length + 1) { // this gives us some confidence that we have at least one character preceding the extension (e.g., x.hdf5) + size_t extension_length = + m_file_handle->get_file_name_extension().size() + 1; // + 1 for the "." before the extension + if (ufn_len > extension_length + 1) { // this gives us some confidence that we have at least one character + // preceding the extension (e.g., x.hdf5) std::string timestamp_substring = "_" + file_creation_timestamp; TLOG_DEBUG(TLVL_BASIC) << get_name() << ": timestamp substring for filename: " << timestamp_substring; unique_filename.insert(ufn_len - extension_length, timestamp_substring); @@ -524,7 +510,7 @@ class FileDataStoreImpl : public DataStore bool m_run_is_for_test_purposes; std::string m_basic_name_of_open_file; - + // Size of data being written, excluding metadata std::atomic m_recorded_size; @@ -551,9 +537,8 @@ class FileDataStoreImpl : public DataStore const size_t m_max_file_size; const bool m_disable_unique_suffix; float m_free_space_safety_factor_for_write; - }; - + } // namespace dfmodules } // namespace dunedaq diff --git a/include/dfmodules/detail/FileDataStoreImpl.hxx b/include/dfmodules/detail/FileDataStoreImpl.hxx index eae0aa04..a98d2bd9 100644 --- a/include/dfmodules/detail/FileDataStoreImpl.hxx +++ b/include/dfmodules/detail/FileDataStoreImpl.hxx @@ -1,62 +1,68 @@ namespace dunedaq::dfmodules { - template - inline std::string FileDataStoreImpl::get_file_name(const daqdataformats::run_number_t run_number) const { - - std::ostringstream work_oss; - work_oss << m_config_params->get_directory_path(); - if (work_oss.str().length() > 0) { - work_oss << "/"; - } - work_oss << m_operational_environment + "_" + m_config_params->get_filename_params()->get_file_type_prefix(); - if (work_oss.str().length() > 0) { - work_oss << "_"; - } - - work_oss << m_config_params->get_filename_params()->get_run_number_prefix(); - work_oss << std::setw(m_config_params->get_filename_params()->get_digits_for_run_number()) << std::setfill('0') - << run_number; +template +inline std::string +FileDataStoreImpl::get_file_name(const daqdataformats::run_number_t run_number) const +{ + + std::ostringstream work_oss; + work_oss << m_config_params->get_directory_path(); + if (work_oss.str().length() > 0) { + work_oss << "/"; + } + work_oss << m_operational_environment + "_" + m_config_params->get_filename_params()->get_file_type_prefix(); + if (work_oss.str().length() > 0) { work_oss << "_"; + } - work_oss << m_config_params->get_filename_params()->get_file_index_prefix(); - work_oss << std::setw(m_config_params->get_filename_params()->get_digits_for_file_index()) << std::setfill('0') - << m_file_index; + work_oss << m_config_params->get_filename_params()->get_run_number_prefix(); + work_oss << std::setw(m_config_params->get_filename_params()->get_digits_for_run_number()) << std::setfill('0') + << run_number; + work_oss << "_"; - work_oss << "_" << m_writer_identifier; - work_oss << "." << m_file_handle->get_file_name_extension(); - return work_oss.str(); - } + work_oss << m_config_params->get_filename_params()->get_file_index_prefix(); + work_oss << std::setw(m_config_params->get_filename_params()->get_digits_for_file_index()) << std::setfill('0') + << m_file_index; - template - inline size_t FileDataStoreImpl::get_free_space(const std::string& the_path) const { - struct statvfs vfs_results; - int retval = statvfs(the_path.c_str(), &vfs_results); - if (retval != 0) { - return 0; - } - return vfs_results.f_bsize * vfs_results.f_bavail; + work_oss << "_" << m_writer_identifier; + work_oss << "." << m_file_handle->get_file_name_extension(); + return work_oss.str(); +} + +template +inline size_t +FileDataStoreImpl::get_free_space(const std::string& the_path) const +{ + struct statvfs vfs_results; + int retval = statvfs(the_path.c_str(), &vfs_results); + if (retval != 0) { + return 0; } + return vfs_results.f_bsize * vfs_results.f_bavail; +} + +template +inline void +FileDataStoreImpl::throw_if_insufficient_space_for_object(const size_t obj_size, + const std::string& obj_name) const +{ - template - inline void FileDataStoreImpl::throw_if_insufficient_space_for_object(const size_t obj_size, - const std::string& obj_name) const { - - size_t current_free_space = get_free_space(m_path); - - if (current_free_space < (m_free_space_safety_factor_for_write * obj_size)) { - std::ostringstream msg_oss; - msg_oss << "a safety factor of " << m_free_space_safety_factor_for_write << " times the " << obj_name << " size"; - InsufficientDiskSpace issue(ERS_HERE, - get_name(), - m_path, - current_free_space, - (m_free_space_safety_factor_for_write * obj_size), - msg_oss.str()); - std::string msg = - "writing a " + obj_name + " to file" + (m_file_handle ? " " + m_file_handle->get_file_name() : ""); - throw RetryableDataStoreProblem(ERS_HERE, get_name(), msg, issue); - } + size_t current_free_space = get_free_space(m_path); + + if (current_free_space < (m_free_space_safety_factor_for_write * obj_size)) { + std::ostringstream msg_oss; + msg_oss << "a safety factor of " << m_free_space_safety_factor_for_write << " times the " << obj_name << " size"; + InsufficientDiskSpace issue(ERS_HERE, + get_name(), + m_path, + current_free_space, + (m_free_space_safety_factor_for_write * obj_size), + msg_oss.str()); + std::string msg = + "writing a " + obj_name + " to file" + (m_file_handle ? " " + m_file_handle->get_file_name() : ""); + throw RetryableDataStoreProblem(ERS_HERE, get_name(), msg, issue); } - +} + } // namespace dunedaq::dfmodules diff --git a/plugins/DFOModule.cpp b/plugins/DFOModule.cpp index a7eba76b..88b09ff1 100644 --- a/plugins/DFOModule.cpp +++ b/plugins/DFOModule.cpp @@ -93,7 +93,6 @@ DFOModule::init(std::shared_ptr mcfg) } if (m_busy_sender == nullptr) { throw appfwk::MissingConnection(ERS_HERE, get_name(), datatype_to_string(), "output"); - } m_dfo_conf = mdal->get_configuration(); @@ -149,7 +148,8 @@ DFOModule::do_start(const CommandData_t& payload) auto sender = iom->get_sender(trb_conn); if (sender != nullptr) { bool is_ready = sender->is_ready_for_sending(std::chrono::milliseconds(100)); - TLOG_DEBUG(0) << "The TriggerDecision sender for " << trb_conn << " " << (is_ready ? "is" : "is not") << " ready."; + TLOG_DEBUG(0) << "The TriggerDecision sender for " << trb_conn << " " << (is_ready ? "is" : "is not") + << " ready."; } } iom->add_callback( @@ -196,7 +196,7 @@ DFOModule::do_stop(const CommandData_t& /*args*/) std::lock_guard guard(m_trigger_counters_mutex); m_trigger_counters.clear(); - + TLOG() << get_name() << " successfully stopped"; TLOG_DEBUG(TLVL_ENTER_EXIT_METHODS) << get_name() << ": Exiting do_stop() method"; } @@ -219,18 +219,17 @@ DFOModule::receive_trigger_decision(const dfmessages::TriggerDecision& decision) << decision.trigger_number << " and run " << decision.run_number << " (current run is " << m_run_number << ")"; if (decision.run_number != m_run_number) { - ers::error(DFOModuleRunNumberMismatch( - ERS_HERE, decision.run_number, m_run_number, "MLT", decision.trigger_number)); + ers::error(DFOModuleRunNumberMismatch(ERS_HERE, decision.run_number, m_run_number, "MLT", decision.trigger_number)); return; } auto decision_received = std::chrono::steady_clock::now(); ++m_received_decisions; auto trigger_types = unpack_types(decision.trigger_type); - for ( const auto t : trigger_types ) { + for (const auto t : trigger_types) { ++get_trigger_counter(t).received; } - + std::chrono::steady_clock::time_point decision_assigned; do { @@ -255,8 +254,7 @@ DFOModule::receive_trigger_decision(const dfmessages::TriggerDecision& decision) << " to connection " << assignment->connection_name; break; } else { - ers::error( - TRBModuleAppUpdate(ERS_HERE, assignment->connection_name, "Could not send Trigger Decision")); + ers::error(TRBModuleAppUpdate(ERS_HERE, assignment->connection_name, "Could not send Trigger Decision")); m_dataflow_availability[assignment->connection_name]->set_in_error(true); } @@ -340,11 +338,11 @@ DFOModule::find_slot(const dfmessages::TriggerDecision& decision) } void -DFOModule::generate_opmon_data() +DFOModule::generate_opmon_data() { opmon::DFOInfo info; - info.set_tokens_received( m_received_tokens.exchange(0) ); + info.set_tokens_received(m_received_tokens.exchange(0)); info.set_decisions_sent(m_sent_decisions.exchange(0)); info.set_decisions_received(m_received_decisions.exchange(0)); info.set_waiting_for_decision(m_waiting_for_decision.exchange(0)); @@ -352,16 +350,16 @@ DFOModule::generate_opmon_data() info.set_forwarding_decision(m_forwarding_decision.exchange(0)); info.set_waiting_for_token(m_waiting_for_token.exchange(0)); info.set_processing_token(m_processing_token.exchange(0)); - publish( std::move(info) ); + publish(std::move(info)); - std::lock_guard guard(m_trigger_counters_mutex); - for ( auto & [type, counts] : m_trigger_counters ) { + std::lock_guard guard(m_trigger_counters_mutex); + for (auto& [type, counts] : m_trigger_counters) { opmon::TriggerInfo ti; ti.set_received(counts.received.exchange(0)); ti.set_completed(counts.completed.exchange(0)); auto name = dunedaq::trgdataformats::trigger_candidate_type_to_string(type); - publish( std::move(ti), {{"type", name}} ); - } + publish(std::move(ti), { { "type", name } }); + } } void @@ -382,14 +380,14 @@ DFOModule::receive_trigger_complete_token(const dfmessages::TriggerDecisionToken } TLOG_DEBUG(TLVL_TDTOKEN_RECEIVED) << get_name() << " Received TriggerDecisionToken for trigger_number " - << token.trigger_number << " and run " << token.run_number - << " (current run is " << m_run_number << ")"; + << token.trigger_number << " and run " << token.run_number << " (current run is " + << m_run_number << ")"; // add a check to see if the application data found if (token.run_number != m_run_number) { std::ostringstream oss_source; oss_source << "TRB at connection " << token.decision_destination; - ers::error(DFOModuleRunNumberMismatch( - ERS_HERE, token.run_number, m_run_number, oss_source.str(), token.trigger_number)); + ers::error( + DFOModuleRunNumberMismatch(ERS_HERE, token.run_number, m_run_number, oss_source.str(), token.trigger_number)); return; } @@ -406,7 +404,8 @@ DFOModule::receive_trigger_complete_token(const dfmessages::TriggerDecisionToken try { 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; + for (const auto t : trigger_types) + ++get_trigger_counter(t).completed; } catch (AssignedTriggerDecisionNotFound const& err) { ers::error(err); } diff --git a/plugins/DFOModule.hpp b/plugins/DFOModule.hpp index ad280b6c..653e941b 100644 --- a/plugins/DFOModule.hpp +++ b/plugins/DFOModule.hpp @@ -27,10 +27,10 @@ #include #include +#include #include #include #include -#include namespace dunedaq { @@ -45,9 +45,9 @@ ERS_DECLARE_ISSUE(dfmodules, ((std::string)connection_name)) ERS_DECLARE_ISSUE(dfmodules, DFOModuleRunNumberMismatch, - "DFOModule encountered run number mismatch: recvd (" - << received_run_number << ") != " << run_number << " from " << src_app << " for trigger_number " - << trig_num, + "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) ERS_DECLARE_ISSUE(dfmodules, @@ -80,11 +80,10 @@ class DFOModule : public dunedaq::appfwk::DAQModule */ explicit DFOModule(const std::string& name); - DFOModule(const DFOModule&) = delete; ///< DFOModule is not copy-constructible - DFOModule& operator=(const DFOModule&) = - delete; ///< DFOModule is not copy-assignable - DFOModule(DFOModule&&) = delete; ///< DFOModule is not move-constructible - DFOModule& operator=(DFOModule&&) = delete; ///< DFOModule is not move-assignable + DFOModule(const DFOModule&) = delete; ///< DFOModule is not copy-constructible + DFOModule& operator=(const DFOModule&) = delete; ///< DFOModule is not copy-assignable + DFOModule(DFOModule&&) = delete; ///< DFOModule is not move-constructible + DFOModule& operator=(DFOModule&&) = delete; ///< DFOModule is not move-assignable void init(std::shared_ptr mcfg) override; @@ -139,22 +138,25 @@ class DFOModule : public dunedaq::appfwk::DAQModule mutable std::mutex m_notify_trigger_mutex; // Struct for statistic - struct TriggerData { - std::atomic received{0}; - std::atomic completed{0}; + struct TriggerData + { + std::atomic received{ 0 }; + std::atomic completed{ 0 }; }; - static std::set - unpack_types( decltype(dfmessages::TriggerDecision::trigger_type) t) { + static std::set unpack_types( + decltype(dfmessages::TriggerDecision::trigger_type) t) + { std::set results; if (t == dfmessages::TypeDefaults::s_invalid_trigger_type) return results; const std::bitset<64> bits(t); - for( size_t i = 0; i < bits.size(); ++i ) { - if ( bits[i] ) results.insert((trgdataformats::TriggerCandidateData::Type)i); + for (size_t i = 0; i < bits.size(); ++i) { + if (bits[i]) + results.insert((trgdataformats::TriggerCandidateData::Type)i); } return results; } - + // Statistics std::atomic m_received_tokens{ 0 }; // NOLINT (build/unsigned) std::atomic m_sent_decisions{ 0 }; // NOLINT (build/unsigned) @@ -165,15 +167,16 @@ class DFOModule : public dunedaq::appfwk::DAQModule std::atomic m_waiting_for_token{ 0 }; // NOLINT (build/unsigned) std::atomic m_processing_token{ 0 }; // NOLINT (build/unsigned) std::map m_trigger_counters; - std::mutex m_trigger_counters_mutex; // used to safely handle the map above - TriggerData & get_trigger_counter(trgdataformats::TriggerCandidateData::Type type) { + std::mutex m_trigger_counters_mutex; // used to safely handle the map above + TriggerData& get_trigger_counter(trgdataformats::TriggerCandidateData::Type type) + { auto it = m_trigger_counters.find(type); - if (it != m_trigger_counters.end()) return it->second; - + if (it != m_trigger_counters.end()) + return it->second; + std::lock_guard guard(m_trigger_counters_mutex); return m_trigger_counters[type]; } - }; } // namespace dfmodules } // namespace dunedaq diff --git a/plugins/FragmentAggregatorModule.cpp b/plugins/FragmentAggregatorModule.cpp index f395a5b4..7329ef69 100644 --- a/plugins/FragmentAggregatorModule.cpp +++ b/plugins/FragmentAggregatorModule.cpp @@ -10,8 +10,8 @@ #include "dfmodules/CommonIssues.hpp" #include "dfmodules/opmon/FragmentAggregatorModule.pb.h" -#include "appmodel/FragmentAggregatorModule.hpp" #include "appmodel/FragmentAggregatorConf.hpp" +#include "appmodel/FragmentAggregatorModule.hpp" #include "confmodel/Connection.hpp" #include "confmodel/QueueWithSourceId.hpp" #include "daqdataformats/FragmentHeader.hpp" diff --git a/plugins/FragmentAggregatorModule.hpp b/plugins/FragmentAggregatorModule.hpp index 4ebcc98d..68cd54a5 100644 --- a/plugins/FragmentAggregatorModule.hpp +++ b/plugins/FragmentAggregatorModule.hpp @@ -1,6 +1,6 @@ /** - * @file FragmentAggregatorModule.hpp Module to dispatch data requests within an application, aggregate and send fragments - * using the IOMManager + * @file FragmentAggregatorModule.hpp Module to dispatch data requests within an application, aggregate and send + * fragments using the IOMManager * * This is part of the DUNE DAQ , copyright 2020. * Licensing/copyright details are in the COPYING file that you should have @@ -39,15 +39,12 @@ ERS_DECLARE_ISSUE(dfmodules, ///< Namespace ((daqdataformats::SourceID)src) ///< Message parameters ) - -ERS_DECLARE_ISSUE(dfmodules, ///< Namespace - AbandonedFragment, ///< Issue class name - "Fragment from " << source << " for trigger " << trigger << '-' << sequence << " of run " << run << " was dropped", - ((daqdataformats::run_number_t)run) - ((daqdataformats::trigger_number_t)trigger) - ((daqdataformats::sequence_number_t)sequence) - ((daqdataformats::SourceID)source) -) +ERS_DECLARE_ISSUE(dfmodules, ///< Namespace + AbandonedFragment, ///< Issue class name + "Fragment from " << source << " for trigger " << trigger << '-' << sequence << " of run " << run + << " was dropped", + ((daqdataformats::run_number_t)run)((daqdataformats::trigger_number_t)trigger)( + (daqdataformats::sequence_number_t)sequence)((daqdataformats::SourceID)source)) namespace dfmodules { diff --git a/plugins/HDF5DataStore.cpp b/plugins/HDF5DataStore.cpp index 36f9e76e..2d0d8de7 100644 --- a/plugins/HDF5DataStore.cpp +++ b/plugins/HDF5DataStore.cpp @@ -1,7 +1,7 @@ -/** - * 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. +/** + * 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. */ #include "HDF5DataStore.hpp" diff --git a/plugins/HDF5DataStore.hpp b/plugins/HDF5DataStore.hpp index 4ff84aa6..55de73c3 100644 --- a/plugins/HDF5DataStore.hpp +++ b/plugins/HDF5DataStore.hpp @@ -22,48 +22,52 @@ namespace dunedaq::dfmodules { - class HDF5DataStore : public FileDataStoreImpl { +class HDF5DataStore : public FileDataStoreImpl +{ - public: - explicit HDF5DataStore(std::string const& name, +public: + explicit HDF5DataStore(std::string const& name, std::shared_ptr mcfg, - std::string const& writer_name) : - FileDataStoreImpl(name, mcfg, writer_name) - {} + std::string const& writer_name) + : FileDataStoreImpl(name, mcfg, writer_name) + { + } - void open_new_file(const std::string& unique_filename) override; - }; + void open_new_file(const std::string& unique_filename) override; +}; - inline void HDF5DataStore::open_new_file(const std::string& unique_filename) { +inline void +HDF5DataStore::open_new_file(const std::string& unique_filename) +{ - auto& file_handle {get_file_handle()}; - try { - file_handle.reset( - new hdf5libs::HDF5RawDataFile(unique_filename, - get_run_number(), - get_file_index(), - get_application_name(), - get_configuration().get_file_layout_params(), - hdf5libs::HDF5SourceIDHandler::make_source_id_geo_id_map(get_session()), - get_compression_level(), - ".writing", - HighFive::File::OpenOrCreate)); - } catch (std::exception const& excpt) { - throw FileOperationProblem(ERS_HERE, get_name(), unique_filename, excpt); - } catch (...) { // NOLINT(runtime/exceptions) - // NOLINT here because we *ARE* re-throwing the exception! - throw FileOperationProblem(ERS_HERE, get_name(), unique_filename); - } + auto& file_handle{ get_file_handle() }; + try { + file_handle.reset( + new hdf5libs::HDF5RawDataFile(unique_filename, + get_run_number(), + get_file_index(), + get_application_name(), + get_configuration().get_file_layout_params(), + hdf5libs::HDF5SourceIDHandler::make_source_id_geo_id_map(get_session()), + get_compression_level(), + ".writing", + HighFive::File::OpenOrCreate)); + } catch (std::exception const& excpt) { + throw FileOperationProblem(ERS_HERE, get_name(), unique_filename, excpt); + } catch (...) { // NOLINT(runtime/exceptions) + // NOLINT here because we *ARE* re-throwing the exception! + throw FileOperationProblem(ERS_HERE, get_name(), unique_filename); + } - TLOG_DEBUG(TLVL_BASIC) << get_name() << "Created HDF5 file (" << unique_filename << ")."; + TLOG_DEBUG(TLVL_BASIC) << get_name() << "Created HDF5 file (" << unique_filename << ")."; - // write attributes that aren't being handled by the HDF5RawDataFile right now - file_handle->write_attribute("operational_environment", std::string(get_operational_environment())); - file_handle->write_attribute("offline_data_stream", std::string(get_offline_data_stream())); - file_handle->write_attribute("run_was_for_test_purposes", std::string(get_run_is_for_test_purposes() ? "true" : "false")); - } + // write attributes that aren't being handled by the HDF5RawDataFile right now + file_handle->write_attribute("operational_environment", std::string(get_operational_environment())); + file_handle->write_attribute("offline_data_stream", std::string(get_offline_data_stream())); + file_handle->write_attribute("run_was_for_test_purposes", + std::string(get_run_is_for_test_purposes() ? "true" : "false")); +} } // namespace dunedaq::dfmodules #endif // DFMODULES_PLUGINS_HDF5DATASTORE_HPP_ - diff --git a/plugins/SummaryTextDataStore.cpp b/plugins/SummaryTextDataStore.cpp index 559b973b..40cc41a5 100644 --- a/plugins/SummaryTextDataStore.cpp +++ b/plugins/SummaryTextDataStore.cpp @@ -1,7 +1,7 @@ -/** - * 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. +/** + * 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. */ #include "SummaryTextDataStore.hpp" diff --git a/plugins/SummaryTextDataStore.hpp b/plugins/SummaryTextDataStore.hpp index efc62ec7..b638fae3 100644 --- a/plugins/SummaryTextDataStore.hpp +++ b/plugins/SummaryTextDataStore.hpp @@ -25,47 +25,48 @@ namespace dunedaq::dfmodules { - class SummaryTextDataStore : public FileDataStoreImpl { - - public: - explicit SummaryTextDataStore(std::string const& name, - std::shared_ptr mcfg, - std::string const& writer_name) : - FileDataStoreImpl(name, mcfg, writer_name), - m_sds_config { mcfg ? mcfg->get_dal(name) : nullptr }, - m_derivval { m_sds_config ? m_sds_config->get_derivval() : std::numeric_limits::max() } - {} - - void open_new_file(const std::string& unique_filename) override; +class SummaryTextDataStore : public FileDataStoreImpl +{ + +public: + explicit SummaryTextDataStore(std::string const& name, + std::shared_ptr mcfg, + std::string const& writer_name) + : FileDataStoreImpl(name, mcfg, writer_name) + , m_sds_config{ mcfg ? mcfg->get_dal(name) : nullptr } + , m_derivval{ m_sds_config ? m_sds_config->get_derivval() : std::numeric_limits::max() } + { + } - // This getter function and its underlying member serve no purpose - // other than to demonstrate how you can add parameters specific - // to your implementation of DataStore + void open_new_file(const std::string& unique_filename) override; - int get_derivval() const { return m_derivval; } + // This getter function and its underlying member serve no purpose + // other than to demonstrate how you can add parameters specific + // to your implementation of DataStore - private: - const DataStoreConfTestDeriv* m_sds_config; - const int m_derivval; - }; + int get_derivval() const { return m_derivval; } - inline void SummaryTextDataStore::open_new_file(const std::string& unique_filename) { +private: + const DataStoreConfTestDeriv* m_sds_config; + const int m_derivval; +}; - auto& file_handle {get_file_handle()}; - try { - file_handle.reset( - new dfmodules::SummaryTextDataWriter(unique_filename) - ); - } catch (std::exception const& excpt) { - throw FileOperationProblem(ERS_HERE, get_name(), unique_filename, excpt); - } catch (...) { // NOLINT(runtime/exceptions) - // NOLINT here because we *ARE* re-throwing the exception! - throw FileOperationProblem(ERS_HERE, get_name(), unique_filename); - } +inline void +SummaryTextDataStore::open_new_file(const std::string& unique_filename) +{ - TLOG_DEBUG(TLVL_BASIC) << get_name() << "Created stub file (" << unique_filename << ")."; + auto& file_handle{ get_file_handle() }; + try { + file_handle.reset(new dfmodules::SummaryTextDataWriter(unique_filename)); + } catch (std::exception const& excpt) { + throw FileOperationProblem(ERS_HERE, get_name(), unique_filename, excpt); + } catch (...) { // NOLINT(runtime/exceptions) + // NOLINT here because we *ARE* re-throwing the exception! + throw FileOperationProblem(ERS_HERE, get_name(), unique_filename); } + + TLOG_DEBUG(TLVL_BASIC) << get_name() << "Created stub file (" << unique_filename << ")."; +} } // namespace dunedaq::dfmodules #endif // DFMODULES_PLUGINS_SUMMARYTEXTDATASTORE_HPP_ - diff --git a/plugins/TRBModule.cpp b/plugins/TRBModule.cpp index bd622f7b..379ebd30 100644 --- a/plugins/TRBModule.cpp +++ b/plugins/TRBModule.cpp @@ -109,7 +109,8 @@ TRBModule::init(std::shared_ptr mcfg) throw InvalidQueueFatalError(ERS_HERE, get_name(), "Fragment Input queue"); } - m_trigger_record_output = iom->get_sender>(mdal->get_trigger_record_output()->UID()); + m_trigger_record_output = + iom->get_sender>(mdal->get_trigger_record_output()->UID()); for (auto con : mdal->get_request_connections()) { for (auto source_id : con->get_source_ids()) { @@ -442,7 +443,7 @@ TRBModule::trigger_decision_callback(dfmessages::TriggerDecision& td) ++m_received_trigger_decisions; create_trigger_records_and_dispatch(td); - //check_stale_requests(); + // check_stale_requests(); auto end_time = std::chrono::steady_clock::now(); m_td_processing_us += std::chrono::duration_cast(end_time - start_time).count(); @@ -477,7 +478,9 @@ TRBModule::extract_trigger_record(const TriggerId& id) m_pending_fragment_counter -= missing_fragments; temp->get_header_ref().set_status_bit(TriggerRecordStatusBits::kIncomplete, true); - ers::error(IncompleteTriggerRecord(ERS_HERE, (m_stop_requested.load() ? "at Stop time " : ""), id, + ers::error(IncompleteTriggerRecord(ERS_HERE, + (m_stop_requested.load() ? "at Stop time " : ""), + id, temp->get_fragments_ref().size(), temp->get_header_ref().get_num_requested_components())); } @@ -667,7 +670,7 @@ TRBModule::send_trigger_record(const TriggerId& id) std::set sent_destinations; while (it != m_mon_requests.end()) { - // Only sent TR to each monitor once + // Only sent TR to each monitor once if (sent_destinations.count(it->data_destination)) { ++it; continue; @@ -683,7 +686,8 @@ TRBModule::send_trigger_record(const TriggerId& id) auto trigger_record_bytes = serialization::serialize(temp_record, serialization::SerializationType::kMsgPack); trigger_record_ptr_t record_copy = serialization::deserialize(trigger_record_bytes); - iom->get_sender(it->data_destination)->send(std::move(record_copy), m_tr_queue_timeout); + iom->get_sender(it->data_destination) + ->send(std::move(record_copy), m_tr_queue_timeout); ++m_trmon_sent_counter; wasSentSuccessfully = true; } catch (const ers::Issue& excpt) { diff --git a/plugins/TRBModule.hpp b/plugins/TRBModule.hpp index 55977ea3..abb532d8 100644 --- a/plugins/TRBModule.hpp +++ b/plugins/TRBModule.hpp @@ -9,23 +9,23 @@ #ifndef DFMODULES_PLUGINS_TRIGGERRECORDBUILDER_HPP_ #define DFMODULES_PLUGINS_TRIGGERRECORDBUILDER_HPP_ +#include "appmodel/ReadoutApplication.hpp" +#include "appmodel/SmartDaqApplication.hpp" #include "appmodel/TRBConf.hpp" #include "daqdataformats/Fragment.hpp" #include "daqdataformats/SourceID.hpp" #include "daqdataformats/TriggerRecord.hpp" #include "daqdataformats/Types.hpp" -#include "appmodel/ReadoutApplication.hpp" -#include "appmodel/SmartDaqApplication.hpp" #include "dfmessages/DataRequest.hpp" #include "dfmessages/TRMonRequest.hpp" #include "dfmessages/TriggerDecision.hpp" #include "dfmessages/Types.hpp" #include "appfwk/DAQModule.hpp" -#include "utilities/WorkerThread.hpp" -#include "iomanager/Sender.hpp" #include "iomanager/Receiver.hpp" +#include "iomanager/Sender.hpp" #include "logging/Logging.hpp" // NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG< mcfg) override; @@ -214,8 +216,7 @@ class TRBModule : public dunedaq::appfwk::DAQModule unsigned int create_trigger_records_and_dispatch(const dfmessages::TriggerDecision&); - bool dispatch_data_requests(dfmessages::DataRequest, - const daqdataformats::SourceID&); + bool dispatch_data_requests(dfmessages::DataRequest, const daqdataformats::SourceID&); bool send_trigger_record(const TriggerId&); // this creates a trigger record and send it @@ -233,7 +234,7 @@ class TRBModule : public dunedaq::appfwk::DAQModule void do_stop(const CommandData_t&); // Monitoring callback - void tr_requested(const dfmessages::TRMonRequest &); + void tr_requested(const dfmessages::TRMonRequest&); // Threading std::atomic m_stop_requested; @@ -253,7 +254,8 @@ class TRBModule : public dunedaq::appfwk::DAQModule // Output connections std::shared_ptr m_trigger_record_output; mutable std::mutex m_map_sourceid_connections_mutex; - std::map> m_map_sourceid_connections; ///< Mappinng between SourceID and connections + std::map> + m_map_sourceid_connections; ///< Mappinng between SourceID and connections // bookeeping using clock_type = std::chrono::steady_clock; @@ -297,7 +299,6 @@ class TRBModule : public dunedaq::appfwk::DAQModule mutable std::atomic m_td_processing_us = { 0 }; // in between calls mutable std::atomic m_fragment_processing_us = { 0 }; // in between calls - mutable std::atomic m_trmon_request_counter = { 0 }; mutable std::atomic m_trmon_sent_counter = { 0 }; diff --git a/plugins/TRMonRequestorModule.hpp b/plugins/TRMonRequestorModule.hpp old mode 100755 new mode 100644 index 236a1a51..46b06716 --- a/plugins/TRMonRequestorModule.hpp +++ b/plugins/TRMonRequestorModule.hpp @@ -11,17 +11,17 @@ #include "appfwk/DAQModule.hpp" #include "appmodel/TRMonRequestorConf.hpp" -#include "iomanager/IOManager.hpp" -#include "dfmessages/TriggerDecisionToken.hpp" #include "dfmessages/TRMonRequest.hpp" -#include "utilities/WorkerThread.hpp" +#include "dfmessages/TriggerDecisionToken.hpp" #include "dfmodules/opmon/TRMonRequestorModule.pb.h" +#include "iomanager/IOManager.hpp" +#include "utilities/WorkerThread.hpp" #include -#include #include -#include #include +#include +#include namespace dunedaq::dfmodules { class TRMonRequestorModule : public appfwk::DAQModule @@ -44,7 +44,6 @@ class TRMonRequestorModule : public appfwk::DAQModule void generate_opmon_data() override; protected: - using token_receiver_t = iomanager::ReceiverConcept; using trmon_sender_t = iomanager::SenderConcept; @@ -82,8 +81,9 @@ class TRMonRequestorModule : public appfwk::DAQModule std::shared_ptr m_token_receiver; // Monitoring - using const_metric_counter_t = std::invoke_result::type; + using const_metric_counter_t = + std::invoke_result::type; using metric_counter_t = std::remove_const::type; std::atomic m_trigger_records_requested{ 0 }; }; diff --git a/src/SummaryTextDataWriter.cpp b/src/SummaryTextDataWriter.cpp index f985878d..e47e901a 100644 --- a/src/SummaryTextDataWriter.cpp +++ b/src/SummaryTextDataWriter.cpp @@ -92,4 +92,3 @@ SummaryTextDataWriter::write_line(const std::string& line) } } // namespace dunedaq::dfmodules - diff --git a/src/TPBundleHandler.cpp b/src/TPBundleHandler.cpp index bc80e3b7..ace111fa 100644 --- a/src/TPBundleHandler.cpp +++ b/src/TPBundleHandler.cpp @@ -137,14 +137,13 @@ TPBundleHandler::add_tpset(trigger::TPSet&& tpset) if (tsidx_from_begin_time <= m_slice_index_offset) { auto lk = std::lock_guard(m_accumulator_map_mutex); int64_t diff = static_cast(tsidx_from_begin_time) - static_cast(m_slice_index_offset); - if (! m_one_or_more_time_slices_have_aged_out) { - TLOG() << "Updating the slice numbers of existing accumulators by " << (1-diff); + if (!m_one_or_more_time_slices_have_aged_out) { + TLOG() << "Updating the slice numbers of existing accumulators by " << (1 - diff); for (auto& [local_tsidx, local_accum] : m_timeslice_accumulators) { local_accum.update_slice_number(1 - diff); } m_slice_index_offset -= (1 - diff); - } - else { + } else { ers::warning(TardyTPSetReceived(ERS_HERE, tpset.origin.id, tpset.start_time, diff)); return; } @@ -155,10 +154,8 @@ TPBundleHandler::add_tpset(trigger::TPSet&& tpset) { auto lk = std::lock_guard(m_accumulator_map_mutex); if (m_timeslice_accumulators.count(tsidx) == 0) { - TimeSliceAccumulator accum(tsidx * m_slice_interval, - (tsidx + 1) * m_slice_interval, - tsidx - m_slice_index_offset, - m_run_number); + TimeSliceAccumulator accum( + tsidx * m_slice_interval, (tsidx + 1) * m_slice_interval, tsidx - m_slice_index_offset, m_run_number); m_timeslice_accumulators[tsidx] = accum; } } @@ -199,7 +196,9 @@ TPBundleHandler::get_properly_aged_timeslices() m_timeslice_accumulators.erase(tsidx); } - if (list_of_timeslices.size() > 0) {m_one_or_more_time_slices_have_aged_out = true;} + if (list_of_timeslices.size() > 0) { + m_one_or_more_time_slices_have_aged_out = true; + } return list_of_timeslices; } diff --git a/src/TriggerInhibitAgent.cpp b/src/TriggerInhibitAgent.cpp index 69024fca..18288fe0 100644 --- a/src/TriggerInhibitAgent.cpp +++ b/src/TriggerInhibitAgent.cpp @@ -39,7 +39,8 @@ TriggerInhibitAgent::TriggerInhibitAgent(const std::string& parent_name, , m_trigger_inhibit_sender(our_output) , m_trigger_number_at_start_of_processing_chain(0) , m_trigger_number_at_end_of_processing_chain(0) -{} +{ +} void TriggerInhibitAgent::start_checking() diff --git a/src/TriggerRecordBuilderData.cpp b/src/TriggerRecordBuilderData.cpp index 7f44ac7d..bd13b9c0 100644 --- a/src/TriggerRecordBuilderData.cpp +++ b/src/TriggerRecordBuilderData.cpp @@ -33,7 +33,8 @@ TriggerRecordBuilderData::TriggerRecordBuilderData(std::string connection_name, , m_is_busy(false) , m_in_error(false) , m_connection_name(connection_name) -{} +{ +} TriggerRecordBuilderData::TriggerRecordBuilderData(std::string connection_name, size_t busy_threshold, @@ -104,8 +105,7 @@ TriggerRecordBuilderData::complete_assignment(daqdataformats::trigger_number_t t metadata_fun(m_metadata); ++m_complete_counter; - auto completion_time = - std::chrono::duration_cast(now - dec_ptr->assigned_time); + auto completion_time = std::chrono::duration_cast(now - dec_ptr->assigned_time); if (completion_time.count() < m_min_complete_time.load()) m_min_complete_time.store(completion_time.count()); if (completion_time.count() > m_max_complete_time.load()) @@ -113,11 +113,11 @@ TriggerRecordBuilderData::complete_assignment(daqdataformats::trigger_number_t t opmon::TRCompleteInfo i; i.set_completion_time(completion_time.count()); - i.set_tr_number( dec_ptr->decision.trigger_number ); - i.set_run_number( dec_ptr->decision.run_number ); - i.set_trigger_type( dec_ptr->decision.trigger_type ); - publish( std::move(i), {}, opmonlib::to_level(opmonlib::EntryOpMonLevel::kEventDriven) ); - + i.set_tr_number(dec_ptr->decision.trigger_number); + i.set_run_number(dec_ptr->decision.run_number); + i.set_trigger_type(dec_ptr->decision.trigger_type); + publish(std::move(i), {}, opmonlib::to_level(opmonlib::EntryOpMonLevel::kEventDriven)); + return dec_ptr; } @@ -166,10 +166,10 @@ TriggerRecordBuilderData::add_assignment(std::shared_ptr::max() ); + info.set_min_time_since_assignment(std::numeric_limits::max()); info.set_max_time_since_assignment(0); time_counter_t time = 0; @@ -187,22 +187,22 @@ TriggerRecordBuilderData::generate_opmon_data() info.set_max_time_since_assignment(us_since_assignment.count()); } lk.unlock(); - + info.set_total_time_since_assignment(time); // estimate of the capcity auto completed_trigger_records = m_complete_counter.exchange(0); - if ( completed_trigger_records > 0 ) { - m_last_average_time = 1e-6*0.5*(m_min_complete_time.exchange(0) + m_max_complete_time.exchange(0)); // in seconds + if (completed_trigger_records > 0) { + m_last_average_time = + 1e-6 * 0.5 * (m_min_complete_time.exchange(0) + m_max_complete_time.exchange(0)); // in seconds } - if ( m_last_average_time > 0. ) { + if (m_last_average_time > 0.) { // prediction rate metrics - info.set_capacity_rate( 0.5*(m_busy_threshold.load()+m_free_threshold.load())/m_last_average_time ); + info.set_capacity_rate(0.5 * (m_busy_threshold.load() + m_free_threshold.load()) / m_last_average_time); } - + publish(std::move(info)); - } std::chrono::microseconds diff --git a/src/dfmodules/SummaryTextDataWriter.hpp b/src/dfmodules/SummaryTextDataWriter.hpp index 4d712637..93c034af 100644 --- a/src/dfmodules/SummaryTextDataWriter.hpp +++ b/src/dfmodules/SummaryTextDataWriter.hpp @@ -22,8 +22,8 @@ #include namespace dunedaq { - ERS_DECLARE_ISSUE(dfmodules, CantOpenFile, "Unable to open " << file_name, ((std::string)file_name)) - ERS_DECLARE_ISSUE(dfmodules, CantWriteToFile, "Unable to write line to " << file_name, ((std::string)file_name)) +ERS_DECLARE_ISSUE(dfmodules, CantOpenFile, "Unable to open " << file_name, ((std::string)file_name)) +ERS_DECLARE_ISSUE(dfmodules, CantWriteToFile, "Unable to write line to " << file_name, ((std::string)file_name)) } // namespace dunedaq namespace dunedaq::dfmodules { @@ -39,9 +39,7 @@ class SummaryTextDataWriter bool timeslice_already_exists(const daqdataformats::TimeSlice& ts) const; std::string get_file_name() const; - std::string get_file_name_extension() const { - return "txt"; - } + std::string get_file_name_extension() const { return "txt"; } size_t get_recorded_size() const noexcept; size_t get_uncompressed_raw_data_size() const noexcept; size_t get_total_file_size() const noexcept; @@ -52,7 +50,7 @@ class SummaryTextDataWriter SummaryTextDataWriter& operator=(const SummaryTextDataWriter&) = delete; SummaryTextDataWriter(SummaryTextDataWriter&&) = delete; SummaryTextDataWriter& operator=(SummaryTextDataWriter&&) = delete; - + private: void write_line(const std::string& line); diff --git a/src/dfmodules/TPBundleHandler.hpp b/src/dfmodules/TPBundleHandler.hpp index 81e59fe0..aa72f99a 100644 --- a/src/dfmodules/TPBundleHandler.hpp +++ b/src/dfmodules/TPBundleHandler.hpp @@ -14,10 +14,10 @@ #include "daqdataformats/TimeSlice.hpp" #include "daqdataformats/Types.hpp" -#include "trgdataformats/TriggerPrimitive.hpp" #include "ers/Issue.hpp" -#include "trigger/TPSet.hpp" #include "logging/Logging.hpp" // NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG< #include @@ -44,8 +44,8 @@ ERS_DECLARE_ISSUE(dfmodules, ERS_DECLARE_ISSUE(dfmodules, TardyTPSetReceived, "Received a TPSet with a timestamp that is too early compared to ones that have already " - << "been processed, sourceid=" << tpset_source_id << ", start_time=" << tpset_start_time - << ", the calculated timeslice_id is " << tsid, + << "been processed, sourceid=" << tpset_source_id << ", start_time=" << tpset_start_time + << ", the calculated timeslice_id is " << tsid, ((size_t)tpset_source_id)((daqdataformats::timestamp_t)tpset_start_time)((int64_t)tsid)) // Re-enable coverage checking LCOV_EXCL_STOP @@ -94,10 +94,7 @@ class TimeSliceAccumulator return m_update_time; } - void update_slice_number(int delta) - { - m_slice_number += delta; - } + void update_slice_number(int delta) { m_slice_number += delta; } private: daqdataformats::timestamp_t m_begin_time; diff --git a/src/dfmodules/TriggerInhibitAgent.hpp b/src/dfmodules/TriggerInhibitAgent.hpp index b9c8db70..4985e724 100644 --- a/src/dfmodules/TriggerInhibitAgent.hpp +++ b/src/dfmodules/TriggerInhibitAgent.hpp @@ -12,12 +12,12 @@ #ifndef DFMODULES_SRC_DFMODULES_TRIGGERINHIBITAGENT_HPP_ #define DFMODULES_SRC_DFMODULES_TRIGGERINHIBITAGENT_HPP_ -#include "iomanager/Sender.hpp" -#include "iomanager/Receiver.hpp" -#include "utilities/NamedObject.hpp" #include "daqdataformats/Types.hpp" #include "dfmessages/TriggerDecision.hpp" #include "dfmessages/TriggerInhibit.hpp" +#include "iomanager/Receiver.hpp" +#include "iomanager/Sender.hpp" +#include "utilities/NamedObject.hpp" #include "utilities/WorkerThread.hpp" #include @@ -43,8 +43,8 @@ class TriggerInhibitAgent : public utilities::NamedObject * @brief TriggerInhibitAgent Constructor */ explicit TriggerInhibitAgent(const std::string&, - std::shared_ptr, - std::shared_ptr); + std::shared_ptr, + std::shared_ptr); TriggerInhibitAgent(const TriggerInhibitAgent&) = delete; ///< TriggerInhibitAgent is not copy-constructible TriggerInhibitAgent& operator=(const TriggerInhibitAgent&) = delete; ///< TriggerInhibitAgent is not copy-assignable diff --git a/src/dfmodules/TriggerRecordBuilderData.hpp b/src/dfmodules/TriggerRecordBuilderData.hpp index 17cd4e2e..f8e64913 100644 --- a/src/dfmodules/TriggerRecordBuilderData.hpp +++ b/src/dfmodules/TriggerRecordBuilderData.hpp @@ -17,9 +17,9 @@ #include "dfmodules/opmon/TRBuilderData.pb.h" #include "ers/Issue.hpp" +#include "logging/Logging.hpp" // NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG< #include @@ -61,7 +61,8 @@ struct AssignedTriggerDecision : decision(dec) , assigned_time(std::chrono::steady_clock::now()) , connection_name(conn_name) - {} + { + } }; class TriggerRecordBuilderData : public opmonlib::MonitorableObject @@ -77,7 +78,7 @@ class TriggerRecordBuilderData : public opmonlib::MonitorableObject TriggerRecordBuilderData& operator=(TriggerRecordBuilderData&&) = delete; ~TriggerRecordBuilderData() = default; - + bool is_busy() const { return m_in_error || m_is_busy; } size_t used_slots() const { return m_assigned_trigger_decisions.size(); } @@ -118,12 +119,12 @@ class TriggerRecordBuilderData : public opmonlib::MonitorableObject // monitoring using metric_t = dunedaq::dfmodules::opmon::DFApplicationInfo; - using const_time_counter_t = std::invoke_result::type; + using const_time_counter_t = std::invoke_result::type; using time_counter_t = std::remove_const::type; std::atomic m_complete_counter{ 0 }; - std::atomic m_min_complete_time{ std::numeric_limits::max() }, m_max_complete_time{ 0 }; // in us - double m_last_average_time{0.}; + std::atomic m_min_complete_time{ std::numeric_limits::max() }, + m_max_complete_time{ 0 }; // in us + double m_last_average_time{ 0. }; }; } // namespace dfmodules } // namespace dunedaq diff --git a/unittest/DataStoreFactory_test.cxx b/unittest/DataStoreFactory_test.cxx index d197697d..78c1ba02 100644 --- a/unittest/DataStoreFactory_test.cxx +++ b/unittest/DataStoreFactory_test.cxx @@ -24,7 +24,6 @@ BOOST_AUTO_TEST_CASE(invalid_request) // we want to pass an invalid DataStore type and see if we get an exception BOOST_CHECK_THROW(make_data_store("dummy", "dummy", nullptr, "dummy_writer"), DataStoreCreationFailed); - } #if 0 diff --git a/unittest/HDF5Write_test.cxx b/unittest/HDF5Write_test.cxx index 68078f50..a53207e7 100644 --- a/unittest/HDF5Write_test.cxx +++ b/unittest/HDF5Write_test.cxx @@ -12,12 +12,12 @@ // We need the actual HDF5DataStore.hpp plugin header so the unit tests can access its exceptions #include "../plugins/HDF5DataStore.hpp" // NOLINT(build/include_path) -#include "appmodel/DataWriterModule.hpp" +#include "appmodel/DataStoreConf.hpp" #include "appmodel/DataWriterConf.hpp" +#include "appmodel/DataWriterModule.hpp" #include "appmodel/FilenameParams.hpp" #include "confmodel/DetectorConfig.hpp" #include "confmodel/Session.hpp" -#include "appmodel/DataStoreConf.hpp" #include "detdataformats/DetID.hpp" #define BOOST_TEST_MODULE HDF5Write_test // NOLINT @@ -147,7 +147,8 @@ BOOST_AUTO_TEST_SUITE(HDF5Write_test) BOOST_AUTO_TEST_CASE(NullConfiguration) { - BOOST_CHECK_THROW(make_data_store("HDF5DataStore", "dummy", nullptr, "dummy"), dunedaq::dfmodules::FileDataStoreImplBadConfiguration); + BOOST_CHECK_THROW(make_data_store("HDF5DataStore", "dummy", nullptr, "dummy"), + dunedaq::dfmodules::FileDataStoreImplBadConfiguration); } BOOST_AUTO_TEST_CASE(WriteEventFiles) @@ -213,7 +214,7 @@ BOOST_AUTO_TEST_CASE(WriteOneFile) data_store_conf_obj.set_by_val("directory_path", file_path); auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr, "dwm-01"); - + // write several events, each with several fragments for (int trigger_number = 1; trigger_number <= trigger_count; ++trigger_number) data_store_ptr->write(create_trigger_record(trigger_number, fragment_size, apa_count * link_count)); @@ -253,7 +254,7 @@ BOOST_AUTO_TEST_CASE(CheckWritingSuffix) data_store_conf_obj.set_by_val("directory_path", file_path); auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr, "dwm-01"); - + // write several events, each with several fragments for (int trigger_number = 1; trigger_number <= trigger_count; ++trigger_number) { data_store_ptr->write(create_trigger_record(trigger_number, fragment_size, apa_count * link_count)); @@ -290,8 +291,8 @@ BOOST_AUTO_TEST_CASE(NoDuplicateTimeSlices) auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr, "dwm-01"); - dunedaq::daqdataformats::TimeSlice timeslice {999, 999}; // timeslice #, run # - dunedaq::daqdataformats::TimeSlice identical_timeslice {999, 999}; + dunedaq::daqdataformats::TimeSlice timeslice{ 999, 999 }; // timeslice #, run # + dunedaq::daqdataformats::TimeSlice identical_timeslice{ 999, 999 }; data_store_ptr->write(timeslice); @@ -331,7 +332,6 @@ BOOST_AUTO_TEST_CASE(EnormousMaxFileSize) BOOST_CHECK_THROW(data_store_ptr->prepare_for_run(1, true), dunedaq::dfmodules::InsufficientDiskSpace); } - BOOST_AUTO_TEST_CASE(FileSizeLimitResultsInMultipleFiles) { std::string file_path(std::filesystem::temp_directory_path()); @@ -358,7 +358,7 @@ BOOST_AUTO_TEST_CASE(FileSizeLimitResultsInMultipleFiles) data_store_conf_obj.set_by_val("max_file_size", 3000000); // goal is 6 events per file auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr, "dwm-01"); - + // write several events, each with several fragments for (int trigger_number = 1; trigger_number <= trigger_count; ++trigger_number) data_store_ptr->write(create_trigger_record(trigger_number, fragment_size, apa_count * link_count)); @@ -401,7 +401,7 @@ BOOST_AUTO_TEST_CASE(SmallFileSizeLimitDataBlockListWrite) data_store_conf_obj.set_by_val("directory_path", file_path); data_store_conf_obj.set_by_val("max_file_size", 150000); // ~1.5 Fragment, ~0.3 TR - auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr,"dwm-01"); + auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr, "dwm-01"); // write several events, each with several fragments for (int trigger_number = 1; trigger_number <= trigger_count; ++trigger_number) diff --git a/unittest/SummaryTextWrite_test.cxx b/unittest/SummaryTextWrite_test.cxx index 4befe567..39dc004b 100644 --- a/unittest/SummaryTextWrite_test.cxx +++ b/unittest/SummaryTextWrite_test.cxx @@ -20,12 +20,12 @@ // We need the actual SummaryTextDataStore.hpp plugin header so the unit tests can access its exceptions #include "../plugins/SummaryTextDataStore.hpp" // NOLINT(build/include_path) -#include "appmodel/DataWriterModule.hpp" +#include "appmodel/DataStoreConf.hpp" #include "appmodel/DataWriterConf.hpp" +#include "appmodel/DataWriterModule.hpp" #include "appmodel/FilenameParams.hpp" #include "confmodel/DetectorConfig.hpp" #include "confmodel/Session.hpp" -#include "appmodel/DataStoreConf.hpp" #include "detdataformats/DetID.hpp" #define BOOST_TEST_MODULE SummaryTextWrite_test // NOLINT @@ -117,7 +117,8 @@ create_trigger_record(int trig_num, int fragment_size, int element_count) fh.sequence_number = 0; fh.fragment_type = static_cast(dunedaq::daqdataformats::FragmentType::kWIB); - fh.detector_id = static_cast(dunedaq::detdataformats::DetID::Subdetector::kHD_TPC); // NOLINT(build/unsigned) + fh.detector_id = + static_cast(dunedaq::detdataformats::DetID::Subdetector::kHD_TPC); // NOLINT(build/unsigned) fh.element_id = dunedaq::daqdataformats::SourceID(stype_to_use, ele_num); std::unique_ptr frag_ptr( new dunedaq::daqdataformats::Fragment(dummy_data, fragment_size)); @@ -155,7 +156,8 @@ BOOST_AUTO_TEST_SUITE(SummaryTextWrite_test) BOOST_AUTO_TEST_CASE(NullConfiguration) { - BOOST_CHECK_THROW(make_data_store("SummaryTextDataStore", "dummy", nullptr, "dummy"), dunedaq::dfmodules::FileDataStoreImplBadConfiguration); + BOOST_CHECK_THROW(make_data_store("SummaryTextDataStore", "dummy", nullptr, "dummy"), + dunedaq::dfmodules::FileDataStoreImplBadConfiguration); } BOOST_AUTO_TEST_CASE(CheckDerivation) @@ -167,7 +169,8 @@ BOOST_AUTO_TEST_CASE(CheckDerivation) auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr, "dwm-01"); BOOST_REQUIRE(data_store_ptr != nullptr); - const auto stub_data_store_ptr {dynamic_cast(data_store_ptr.get())}; // NOLINT(runtime/rtti) + const auto stub_data_store_ptr{ dynamic_cast( + data_store_ptr.get()) }; // NOLINT(runtime/rtti) BOOST_REQUIRE(stub_data_store_ptr != nullptr); BOOST_REQUIRE_EQUAL(stub_data_store_ptr->get_derivval(), 773); // 773 should be the value in the config @@ -236,7 +239,7 @@ BOOST_AUTO_TEST_CASE(WriteOneFile) data_store_conf_obj.set_by_val("directory_path", file_path); auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr, "dwm-01"); - + // write several events, each with several fragments for (int trigger_number = 1; trigger_number <= trigger_count; ++trigger_number) data_store_ptr->write(create_trigger_record(trigger_number, fragment_size, apa_count * link_count)); @@ -271,8 +274,8 @@ BOOST_AUTO_TEST_CASE(NoDuplicateTimeSlices) auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr, "dwm-01"); - dunedaq::daqdataformats::TimeSlice timeslice {999, 999}; // timeslice #, run # - dunedaq::daqdataformats::TimeSlice identical_timeslice {999, 999}; + dunedaq::daqdataformats::TimeSlice timeslice{ 999, 999 }; // timeslice #, run # + dunedaq::daqdataformats::TimeSlice identical_timeslice{ 999, 999 }; data_store_ptr->write(timeslice); @@ -312,7 +315,6 @@ BOOST_AUTO_TEST_CASE(EnormousMaxFileSize) BOOST_CHECK_THROW(data_store_ptr->prepare_for_run(1, true), dunedaq::dfmodules::InsufficientDiskSpace); } - BOOST_AUTO_TEST_CASE(FileSizeLimitResultsInMultipleFiles) { std::string file_path(std::filesystem::temp_directory_path()); @@ -335,10 +337,10 @@ BOOST_AUTO_TEST_CASE(FileSizeLimitResultsInMultipleFiles) data_store_conf_obj.set_by_val("directory_path", file_path); // Tiny max file size needed since each trigger record just gets a simple line of text written out - data_store_conf_obj.set_by_val("max_file_size", 100); + data_store_conf_obj.set_by_val("max_file_size", 100); auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr, "dwm-01"); - + // write several events, each with several fragments for (int trigger_number = 1; trigger_number <= trigger_count; ++trigger_number) data_store_ptr->write(create_trigger_record(trigger_number, fragment_size, apa_count * link_count)); @@ -381,7 +383,7 @@ BOOST_AUTO_TEST_CASE(SmallFileSizeLimitDataBlockListWrite) data_store_conf_obj.set_by_val("directory_path", file_path); data_store_conf_obj.set_by_val("max_file_size", 150000); // ~1.5 Fragment, ~0.3 TR - auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr,"dwm-01"); + auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr, "dwm-01"); // write several events, each with several fragments for (int trigger_number = 1; trigger_number <= trigger_count; ++trigger_number) diff --git a/unittest/TriggerRecordBuilderData_test.cxx b/unittest/TriggerRecordBuilderData_test.cxx index f381ee6b..a42b6631 100644 --- a/unittest/TriggerRecordBuilderData_test.cxx +++ b/unittest/TriggerRecordBuilderData_test.cxx @@ -7,8 +7,8 @@ * received with this code. */ -#include "opmonlib/TestOpMonManager.hpp" #include "dfmodules/TriggerRecordBuilderData.hpp" +#include "opmonlib/TestOpMonManager.hpp" #define BOOST_TEST_MODULE TriggerRecordBuilderData_test // NOLINT @@ -110,10 +110,10 @@ BOOST_AUTO_TEST_CASE(Assignments) BOOST_REQUIRE_EQUAL(trbd_p->used_slots(), 0); auto latency = - std::chrono::duration_cast(complete_time - assignment->assigned_time) - .count(); + std::chrono::duration_cast(complete_time - assignment->assigned_time).count(); - BOOST_REQUIRE_CLOSE(static_cast(trbd_p->average_latency(start_time).count()), static_cast(latency), 5); + BOOST_REQUIRE_CLOSE( + static_cast(trbd_p->average_latency(start_time).count()), static_cast(latency), 5); auto null_got_assignment = trbd_p->get_assignment(2); BOOST_REQUIRE_EQUAL(null_got_assignment, nullptr); @@ -125,7 +125,6 @@ BOOST_AUTO_TEST_CASE(Assignments) auto remnants = trbd_p->flush(); BOOST_REQUIRE_EQUAL(trbd_p->used_slots(), 0); BOOST_REQUIRE_EQUAL(remnants.size(), 1); - } BOOST_AUTO_TEST_CASE(Exceptions) @@ -185,6 +184,4 @@ BOOST_AUTO_TEST_CASE(Exceptions) trbd.add_assignment(err_assignment), NoSlotsAvailable, [](NoSlotsAvailable const&) { return true; }); } - - BOOST_AUTO_TEST_SUITE_END() From 57cefa023b89c0211f9c9ea2ea7c127d1a35cd08 Mon Sep 17 00:00:00 2001 From: Eric Flumerfelt Date: Mon, 28 Sep 2026 07:54:29 -0500 Subject: [PATCH 2/3] Start working on linting issues --- include/dfmodules/DataStore.hpp | 4 ++-- include/dfmodules/FileDataStoreImpl.hpp | 10 +++++----- plugins/FragmentAggregatorModule.cpp | 2 +- plugins/FragmentAggregatorModule.hpp | 22 +++++++++++----------- plugins/TRBModule.hpp | 12 +++++++----- src/TriggerInhibitAgent.cpp | 6 ++---- src/TriggerRecordBuilderData.cpp | 7 +++---- unittest/DFOModule_test.cxx | 1 + unittest/HDF5Write_test.cxx | 2 +- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/include/dfmodules/DataStore.hpp b/include/dfmodules/DataStore.hpp index ebe6ee8a..8ed695e2 100644 --- a/include/dfmodules/DataStore.hpp +++ b/include/dfmodules/DataStore.hpp @@ -33,7 +33,7 @@ #include #ifndef EXTERN_C_FUNC_DECLARE_START -// NOLINTNEXTLINE(build/define_used) +// NOLINTNEXTLINE #define EXTERN_C_FUNC_DECLARE_START \ extern "C" \ { @@ -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 make(const std::string& name, \ diff --git a/include/dfmodules/FileDataStoreImpl.hpp b/include/dfmodules/FileDataStoreImpl.hpp index c4d45c62..f3d581f1 100644 --- a/include/dfmodules/FileDataStoreImpl.hpp +++ b/include/dfmodules/FileDataStoreImpl.hpp @@ -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 * @@ -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_ @@ -126,7 +126,7 @@ concept FileHandleConcept = requires(T file_handle, { const_file_handle.get_recorded_size() } -> std::convertible_to; { const_file_handle.get_uncompressed_raw_data_size() } -> std::convertible_to; { const_file_handle.get_total_file_size() } -> std::convertible_to; -}; +}; // NOLINT /** * @brief FileDataStoreImpl contains functionality you'd generally diff --git a/plugins/FragmentAggregatorModule.cpp b/plugins/FragmentAggregatorModule.cpp index 7329ef69..8af214d2 100644 --- a/plugins/FragmentAggregatorModule.cpp +++ b/plugins/FragmentAggregatorModule.cpp @@ -132,7 +132,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>(trb_conn); if (sender != nullptr) { bool is_ready = sender->is_ready_for_sending(std::chrono::milliseconds(100)); diff --git a/plugins/FragmentAggregatorModule.hpp b/plugins/FragmentAggregatorModule.hpp index 68cd54a5..a5d0d2de 100644 --- a/plugins/FragmentAggregatorModule.hpp +++ b/plugins/FragmentAggregatorModule.hpp @@ -7,8 +7,8 @@ * received with this code. */ -#ifndef DFMODULES_PLUGINS_FRAGMENTAGGREGATOR_HPP_ -#define DFMODULES_PLUGINS_FRAGMENTAGGREGATOR_HPP_ +#ifndef DFMODULES_PLUGINS_FRAGMENTAGGREGATORMODULE_HPP_ +#define DFMODULES_PLUGINS_FRAGMENTAGGREGATORMODULE_HPP_ #include "daqdataformats/Fragment.hpp" #include "daqdataformats/SourceID.hpp" @@ -34,9 +34,9 @@ ERS_DECLARE_ISSUE(dfmodules, ///< Namespace UnknownFragmentDestination, ///< Issue class name "Could not find a valid destination for sending Fragment with trigger number: " << trg_num << " sequence number: " << seq_num << " from DLH " << src, ///< Message - ((uint64_t)trg_num) ///< Message parameters - ((uint16_t)seq_num) ///< Message parameters - ((daqdataformats::SourceID)src) ///< Message parameters + ((uint64_t)trg_num) ///< Message parameters // NOLINT(build/unsigned) + ((uint16_t)seq_num) ///< Message parameters // NOLINT(build/unsigned) + ((daqdataformats::SourceID)src) ///< Message parameters ) ERS_DECLARE_ISSUE(dfmodules, ///< Namespace @@ -72,16 +72,16 @@ class FragmentAggregatorModule : public dunedaq::appfwk::DAQModule // Input and Output Connection names std::string m_data_req_input; std::string m_fragment_input; - std::map m_producer_conn_ids; + std::map m_producer_conn_ids; // NOLINT(build/unsigned) std::vector m_trb_conn_ids; std::chrono::milliseconds m_fragment_send_timeout; // Opmon - uint64_t get_current_time_us(); - uint64_t m_timestamp_before_dr; - uint64_t m_timestamp_before_frag; - using metric_counter_type = uint64_t; + uint64_t get_current_time_us(); // NOLINT(build/unsigned) + uint64_t m_timestamp_before_dr; // NOLINT(build/unsigned) + uint64_t m_timestamp_before_frag; // NOLINT(build/unsigned) + using metric_counter_type = uint64_t; // NOLINT(build/unsigned) std::atomic m_data_requests_received{ 0 }; std::atomic m_data_requests_processed{ 0 }; std::atomic m_data_requests_failed{ 0 }; @@ -107,4 +107,4 @@ class FragmentAggregatorModule : public dunedaq::appfwk::DAQModule } // namespace dfmodules } // namespace dunedaq -#endif // DFMODULES_PLUGINS_FRAGMENTAGGREGATOR_HPP_ +#endif // DFMODULES_PLUGINS_FRAGMENTAGGREGATORMODULE_HPP_ diff --git a/plugins/TRBModule.hpp b/plugins/TRBModule.hpp index abb532d8..373b6692 100644 --- a/plugins/TRBModule.hpp +++ b/plugins/TRBModule.hpp @@ -6,8 +6,8 @@ * received with this code. */ -#ifndef DFMODULES_PLUGINS_TRIGGERRECORDBUILDER_HPP_ -#define DFMODULES_PLUGINS_TRIGGERRECORDBUILDER_HPP_ +#ifndef DFMODULES_PLUGINS_TRBMODULE_HPP_ +#define DFMODULES_PLUGINS_TRBMODULE_HPP_ #include "appmodel/ReadoutApplication.hpp" #include "appmodel/SmartDaqApplication.hpp" @@ -158,8 +158,10 @@ ERS_DECLARE_ISSUE(dfmodules, ///< Namespace "sending incomplete TriggerRecord downstream " << optional_stop_time_phrase << " (trigger/run_number=" << id << ", " << num_frags_present << " of " << num_components_requested << " fragments included)", - ((std::string)optional_stop_time_phrase)((dfmodules::TriggerId)id)((int)num_frags_present)( - (int)num_components_requested) ///< Message parameters + ((std::string)optional_stop_time_phrase) ///< Message parameters + ((dfmodules::TriggerId)id) ///< Message parameters + ((int)num_frags_present) ///< Message parameters + ((int)num_components_requested) ///< Message parameters ) /** @@ -310,4 +312,4 @@ class TRBModule : public dunedaq::appfwk::DAQModule } // namespace dfmodules } // namespace dunedaq -#endif // DFMODULES_PLUGINS_TRIGGERRECORDBUILDER_HPP_ +#endif // DFMODULES_PLUGINS_TRBMODULE_HPP_ diff --git a/src/TriggerInhibitAgent.cpp b/src/TriggerInhibitAgent.cpp index 18288fe0..0e7d3587 100644 --- a/src/TriggerInhibitAgent.cpp +++ b/src/TriggerInhibitAgent.cpp @@ -25,8 +25,7 @@ enum TLVL_WORK_STEPS = 10 }; -namespace dunedaq { -namespace dfmodules { +namespace dunedaq::dfmodules { TriggerInhibitAgent::TriggerInhibitAgent(const std::string& parent_name, std::shared_ptr our_input, @@ -174,5 +173,4 @@ TriggerInhibitAgent::do_work(std::atomic& running_flag) TLOG_DEBUG(TLVL_ENTER_EXIT_METHODS) << get_name() << ": Exiting do_work() method"; } -} // namespace dfmodules -} // namespace dunedaq +} // namespace dunedaq::dfmodules diff --git a/src/TriggerRecordBuilderData.cpp b/src/TriggerRecordBuilderData.cpp index bd13b9c0..c16948f3 100644 --- a/src/TriggerRecordBuilderData.cpp +++ b/src/TriggerRecordBuilderData.cpp @@ -15,6 +15,7 @@ #include "logging/Logging.hpp" #include +#include #include #include #include @@ -24,8 +25,7 @@ */ #define TRACE_NAME "TRBData" // NOLINT -namespace dunedaq { -namespace dfmodules { +namespace dunedaq::dfmodules { TriggerRecordBuilderData::TriggerRecordBuilderData(std::string connection_name, size_t busy_threshold) : m_busy_threshold(busy_threshold) @@ -222,5 +222,4 @@ TriggerRecordBuilderData::average_latency(std::chrono::steady_clock::time_point return sum / count; } -} // namespace dfmodules -} // namespace dunedaq +} // namespace dunedaq::dfmodules diff --git a/unittest/DFOModule_test.cxx b/unittest/DFOModule_test.cxx index 690ca08a..f7b14d4f 100644 --- a/unittest/DFOModule_test.cxx +++ b/unittest/DFOModule_test.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include using namespace dunedaq::dfmodules; diff --git a/unittest/HDF5Write_test.cxx b/unittest/HDF5Write_test.cxx index a53207e7..72b11b56 100644 --- a/unittest/HDF5Write_test.cxx +++ b/unittest/HDF5Write_test.cxx @@ -125,7 +125,7 @@ create_trigger_record(int trig_num, int fragment_size, int element_count) struct CfgFixture { - CfgFixture(std::string sessionName) + explicit CfgFixture(std::string sessionName) { TLOG_DEBUG(4) << "Creating CfgFixture"; setenv("DUNEDAQ_SESSION", sessionName.c_str(), 1); From d0b9df5a06678dbe0f75891ed4bfdfb3a4c3a2a5 Mon Sep 17 00:00:00 2001 From: Eric Flumerfelt Date: Tue, 29 Sep 2026 13:50:17 -0500 Subject: [PATCH 3/3] Resolve linting issues in dfmodules code --- plugins/DFOModule.cpp | 13 +++---- plugins/DFOModule.hpp | 18 +++++----- plugins/DataWriterModule.cpp | 39 ++++++++++----------- plugins/DataWriterModule.hpp | 8 ++--- plugins/FakeDataProdModule.cpp | 8 ++--- plugins/FakeDataProdModule.hpp | 6 ++-- plugins/FragmentAggregatorModule.cpp | 16 ++++++--- plugins/FragmentAggregatorModule.hpp | 2 ++ plugins/TPStreamWriterModule.cpp | 24 +++++++------ plugins/TPStreamWriterModule.hpp | 8 ++--- plugins/TRBModule.cpp | 18 +++++----- plugins/TRBModule.hpp | 12 ++++--- plugins/TRMonRequestorModule.cpp | 2 +- plugins/TRMonRequestorModule.hpp | 2 +- schema/dfmodules/opmon/TPStreamWriter.proto | 2 +- src/TPBundleHandler.cpp | 10 +++--- src/TriggerInhibitAgent.cpp | 2 +- src/TriggerRecordBuilderData.cpp | 5 +-- src/dfmodules/TriggerInhibitAgent.hpp | 6 ++-- src/dfmodules/TriggerRecordBuilderData.hpp | 2 +- unittest/HDF5Write_test.cxx | 1 + unittest/SummaryTextWrite_test.cxx | 5 +-- unittest/TriggerRecordBuilderData_test.cxx | 1 + 23 files changed, 113 insertions(+), 97 deletions(-) diff --git a/plugins/DFOModule.cpp b/plugins/DFOModule.cpp index 88b09ff1..c4159b83 100644 --- a/plugins/DFOModule.cpp +++ b/plugins/DFOModule.cpp @@ -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(trb_conn); if (sender != nullptr) { bool is_ready = sender->is_ready_for_sending(std::chrono::milliseconds(100)); @@ -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; @@ -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); } @@ -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; @@ -507,8 +507,9 @@ DFOModule::dispatch(const std::shared_ptr& 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"; diff --git a/plugins/DFOModule.hpp b/plugins/DFOModule.hpp index 653e941b..1838ac5f 100644 --- a/plugins/DFOModule.hpp +++ b/plugins/DFOModule.hpp @@ -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" @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -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, @@ -140,8 +142,8 @@ class DFOModule : public dunedaq::appfwk::DAQModule // Struct for statistic struct TriggerData { - std::atomic received{ 0 }; - std::atomic completed{ 0 }; + std::atomic received{ 0 }; // NOLINT(build/unsigned) + std::atomic completed{ 0 }; // NOLINT(build/unsigned) }; static std::set unpack_types( decltype(dfmessages::TriggerDecision::trigger_type) t) @@ -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(i)); } return results; } @@ -181,4 +183,4 @@ class DFOModule : public dunedaq::appfwk::DAQModule } // namespace dfmodules } // namespace dunedaq -#endif // DFMODULES_PLUGINS_DATAFLOWORCHESTRATOR_HPP_ +#endif // DFMODULES_PLUGINS_DFOMODULE_HPP_ diff --git a/plugins/DataWriterModule.cpp b/plugins/DataWriterModule.cpp index 09c6f3a1..03f8012a 100644 --- a/plugins/DataWriterModule.cpp +++ b/plugins/DataWriterModule.cpp @@ -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) @@ -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()); } @@ -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; @@ -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())); @@ -377,16 +377,16 @@ DataWriterModule::receive_trigger_record(std::unique_ptrget_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; @@ -418,7 +418,6 @@ DataWriterModule::do_work(std::atomic& running_flag) } } -} // namespace dfmodules -} // namespace dunedaq +} // namespace dunedaq::dfmodules DEFINE_DUNE_DAQ_MODULE(dunedaq::dfmodules::DataWriterModule) diff --git a/plugins/DataWriterModule.hpp b/plugins/DataWriterModule.hpp index 54127105..4d1d03aa 100644 --- a/plugins/DataWriterModule.hpp +++ b/plugins/DataWriterModule.hpp @@ -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" @@ -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(now - then).count(); + return std::chrono::duration_cast>>(now - then).count(); } }; } // namespace dfmodules @@ -136,4 +136,4 @@ ERS_DECLARE_ISSUE_BASE(dfmodules, } // namespace dunedaq -#endif // DFMODULES_PLUGINS_DATAWRITER_HPP_ +#endif // DFMODULES_PLUGINS_DATAWRITERMODULE_HPP_ diff --git a/plugins/FakeDataProdModule.cpp b/plugins/FakeDataProdModule.cpp index ee65dee9..ee355453 100644 --- a/plugins/FakeDataProdModule.cpp +++ b/plugins/FakeDataProdModule.cpp @@ -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) @@ -155,7 +154,7 @@ FakeDataProdModule::do_timesync(std::atomic& 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)); @@ -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) diff --git a/plugins/FakeDataProdModule.hpp b/plugins/FakeDataProdModule.hpp index de9c12ad..e189c70b 100644 --- a/plugins/FakeDataProdModule.hpp +++ b/plugins/FakeDataProdModule.hpp @@ -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" @@ -99,4 +99,4 @@ class FakeDataProdModule : public dunedaq::appfwk::DAQModule } // namespace dfmodules } // namespace dunedaq -#endif // DFMODULES_PLUGINS_FAKEDATAPROD_HPP_ +#endif // DFMODULES_PLUGINS_FAKEDATAPRODMODULE_HPP_ diff --git a/plugins/FragmentAggregatorModule.cpp b/plugins/FragmentAggregatorModule.cpp index 8af214d2..12fb9f81 100644 --- a/plugins/FragmentAggregatorModule.cpp +++ b/plugins/FragmentAggregatorModule.cpp @@ -21,10 +21,13 @@ #include "iomanager/IOManager.hpp" #include +#include +#include #include +#include +#include -namespace dunedaq { -namespace dfmodules { +namespace dunedaq::dfmodules { FragmentAggregatorModule::FragmentAggregatorModule(const std::string& name) : DAQModule(name) @@ -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::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); @@ -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::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); @@ -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::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::max()); m_data_requests_time_max_us.store(0); @@ -265,14 +272,13 @@ FragmentAggregatorModule::process_fragment(std::unique_ptr(std::chrono::steady_clock::now().time_since_epoch()) .count(); } -} // namespace dfmodules -} // namespace dunedaq +} // namespace dunedaq::dfmodules DEFINE_DUNE_DAQ_MODULE(dunedaq::dfmodules::FragmentAggregatorModule) diff --git a/plugins/FragmentAggregatorModule.hpp b/plugins/FragmentAggregatorModule.hpp index a5d0d2de..9d7668cb 100644 --- a/plugins/FragmentAggregatorModule.hpp +++ b/plugins/FragmentAggregatorModule.hpp @@ -22,9 +22,11 @@ #include #include +#include #include #include #include +#include namespace dunedaq { /** diff --git a/plugins/TPStreamWriterModule.cpp b/plugins/TPStreamWriterModule.cpp index 66006943..1f6ac4b1 100644 --- a/plugins/TPStreamWriterModule.cpp +++ b/plugins/TPStreamWriterModule.cpp @@ -23,6 +23,7 @@ #include "boost/date_time/posix_time/posix_time.hpp" +#include #include #include #include @@ -36,8 +37,7 @@ enum TLVL_CONFIG = 7, }; -namespace dunedaq { -namespace dfmodules { +namespace dunedaq::dfmodules { TPStreamWriterModule::TPStreamWriterModule(const std::string& name) : dunedaq::appfwk::DAQModule(name) @@ -96,7 +96,7 @@ TPStreamWriterModule::do_conf(const CommandData_t&) m_accumulation_inactivity_time_before_write = std::chrono::milliseconds( static_cast(1000 * m_tp_writer_conf->get_tp_accumulation_inactivity_time_before_write_sec())); m_warn_user_when_tardy_tps_are_discarded = m_tp_writer_conf->get_warn_user_when_tardy_tps_are_discarded(); - m_accumulation_interval_seconds = ((double)m_accumulation_interval_ticks) / 62500000.0; + m_accumulation_interval_seconds = static_cast(m_accumulation_interval_ticks) / 62500000.0; // create the DataStore instance here try { @@ -110,7 +110,7 @@ TPStreamWriterModule::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()); } @@ -188,6 +188,7 @@ TPStreamWriterModule::do_work(std::atomic& running_flag) auto start_time = steady_clock::now(); daqdataformats::timestamp_t first_timestamp = 0; daqdataformats::timestamp_t last_timestamp = 0; + daqdataformats::timestamp_t current_timestamp = 0; TPBundleHandler tp_bundle_handler( m_accumulation_interval_ticks, m_run_number, m_accumulation_inactivity_time_before_write); @@ -219,6 +220,7 @@ TPStreamWriterModule::do_work(std::atomic& running_flag) continue; } ++m_tpsets_with_tps; + current_timestamp = tpset.start_time; size_t num_tps_in_tpset = tpset.objects.size(); tp_bundle_handler.add_tpset(std::move(tpset)); @@ -311,22 +313,22 @@ TPStreamWriterModule::do_work(std::atomic& running_flag) } if (first_timestamp == 0) { - first_timestamp = tpset.start_time; + first_timestamp = current_timestamp; } - last_timestamp = tpset.start_time; + last_timestamp = current_timestamp; } // while(running) auto end_time = steady_clock::now(); auto time_ms = duration_cast(end_time - start_time).count(); - float rate_hz = 1e3 * static_cast(n_tpset_received) / time_ms; - float inferred_clock_frequency = 1e3 * (last_timestamp - first_timestamp) / time_ms; + auto rate_hz = 1e3 * n_tpset_received / static_cast(time_ms); + auto inferred_clock_frequency = + 1e3 * static_cast(last_timestamp - first_timestamp) / static_cast(time_ms); TLOG() << "Received " << n_tpset_received << " TPSets in " << time_ms << "ms. " << rate_hz << " TPSet/s. Inferred clock frequency " << inferred_clock_frequency << "Hz"; TLOG_DEBUG(TLVL_ENTER_EXIT_METHODS) << get_name() << ": Exiting do_work() method"; -} // NOLINT Function length +} // NOLINT(readability/fn_size) -} // namespace dfmodules -} // namespace dunedaq +} // namespace dunedaq::dfmodules DEFINE_DUNE_DAQ_MODULE(dunedaq::dfmodules::TPStreamWriterModule) diff --git a/plugins/TPStreamWriterModule.hpp b/plugins/TPStreamWriterModule.hpp index d1979578..4d07b910 100644 --- a/plugins/TPStreamWriterModule.hpp +++ b/plugins/TPStreamWriterModule.hpp @@ -8,8 +8,8 @@ * received with this code. */ -#ifndef DFMODULES_PLUGINS_TPSTREAMWRITER_HPP_ -#define DFMODULES_PLUGINS_TPSTREAMWRITER_HPP_ +#ifndef DFMODULES_PLUGINS_TPSTREAMWRITERMODULE_HPP_ +#define DFMODULES_PLUGINS_TPSTREAMWRITERMODULE_HPP_ #include "dfmodules/DataStore.hpp" @@ -116,8 +116,8 @@ ERS_DECLARE_ISSUE_BASE(dfmodules, "Tardy TPs from SourceIDs [" << sid_list << "] were discarded from TimeSlice number " << trnum << " (~" << sec_too_late << " sec too late)", ((std::string)name), - ((std::string)sid_list)((size_t)trnum)((float)sec_too_late)) + ((std::string)sid_list)((size_t)trnum)((float)sec_too_late)) // NOLINT(readability/casting) } // namespace dunedaq -#endif // DFMODULES_PLUGINS_TPSTREAMWRITER_HPP_ +#endif // DFMODULES_PLUGINS_TPSTREAMWRITERMODULE_HPP_ diff --git a/plugins/TRBModule.cpp b/plugins/TRBModule.cpp index 379ebd30..9b8c7a7f 100644 --- a/plugins/TRBModule.cpp +++ b/plugins/TRBModule.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -52,8 +53,7 @@ enum TLVL_FRAGMENT_RECEIVE = 22 }; -namespace dunedaq { -namespace dfmodules { +namespace dunedaq::dfmodules { using daqdataformats::TriggerRecordStatusBits; @@ -307,6 +307,7 @@ TRBModule::flush_trigger_records() // create all possible trigger record std::vector triggers; for (const auto& entry : m_trigger_records) { + // NOLINTNEXTLINE(performance-inefficient-vector-operation) triggers.push_back(entry.first); } @@ -505,7 +506,7 @@ TRBModule::create_trigger_records_and_dispatch(const dfmessages::TriggerDecision end = component.window_end; } - daqdataformats::timestamp_diff_t tot_width = end - begin; + auto tot_width = static_cast(end - begin); daqdataformats::sequence_number_t max_sequence_number = (m_max_sequence_length > 0 && tot_width > 0) ? ((tot_width - 1) / m_max_sequence_length) : 0; @@ -643,7 +644,8 @@ TRBModule::dispatch_data_requests(dfmessages::DataRequest dr, const daqdataforma // send data request into the corresponding connection try { - sender->send(std::move(dr), m_dreq_queue_timeout); + dfmessages::DataRequest dr_copy = dr; + sender->send(std::move(dr_copy), m_dreq_queue_timeout); wasSentSuccessfully = true; ++m_generated_data_requests; } catch (const ers::Issue& excpt) { @@ -661,6 +663,7 @@ TRBModule::send_trigger_record(const TriggerId& id) { trigger_record_ptr_t temp_record(extract_trigger_record(id)); + size_t record_size = temp_record->get_fragments_ref().size(); // Send to monitoring, if needed @@ -685,7 +688,7 @@ TRBModule::send_trigger_record(const TriggerId& id) // HACK to copy the trigger record so we can send it off to monitoring auto trigger_record_bytes = serialization::serialize(temp_record, serialization::SerializationType::kMsgPack); - trigger_record_ptr_t record_copy = serialization::deserialize(trigger_record_bytes); + auto record_copy = serialization::deserialize(trigger_record_bytes); iom->get_sender(it->data_destination) ->send(std::move(record_copy), m_tr_queue_timeout); ++m_trmon_sent_counter; @@ -717,7 +720,7 @@ TRBModule::send_trigger_record(const TriggerId& id) if (!wasSentSuccessfully) { ++m_abandoned_trigger_records; - m_lost_fragments += temp_record->get_fragments_ref().size(); + m_lost_fragments += record_size; ers::error(dunedaq::dfmodules::AbandonedTriggerDecision(ERS_HERE, id)); } @@ -768,7 +771,6 @@ TRBModule::check_stale_requests() return book_updates; } -} // namespace dfmodules -} // namespace dunedaq +} // namespace dunedaq::dfmodules DEFINE_DUNE_DAQ_MODULE(dunedaq::dfmodules::TRBModule) diff --git a/plugins/TRBModule.hpp b/plugins/TRBModule.hpp index 373b6692..9c5c3de0 100644 --- a/plugins/TRBModule.hpp +++ b/plugins/TRBModule.hpp @@ -92,7 +92,8 @@ struct TriggerId friend std::istream& operator>>(std::istream& in, TriggerId& id) { - char t1, t2; + char t1 = 0; + char t2 = 0; in >> id.trigger_number >> t1 >> id.sequence_number >> t2 >> id.run_number; return in; } @@ -158,10 +159,10 @@ ERS_DECLARE_ISSUE(dfmodules, ///< Namespace "sending incomplete TriggerRecord downstream " << optional_stop_time_phrase << " (trigger/run_number=" << id << ", " << num_frags_present << " of " << num_components_requested << " fragments included)", - ((std::string)optional_stop_time_phrase) ///< Message parameters - ((dfmodules::TriggerId)id) ///< Message parameters - ((int)num_frags_present) ///< Message parameters - ((int)num_components_requested) ///< Message parameters + ((std::string)optional_stop_time_phrase) ///< Message parameters // NOLINT + ((dfmodules::TriggerId)id) ///< Message parameters // NOLINT + ((int)num_frags_present) ///< Message parameters // NOLINT + ((uint64_t)num_components_requested) ///< Message parameters // NOLINT ) /** @@ -278,6 +279,7 @@ class TRBModule : public dunedaq::appfwk::DAQModule std::list m_mon_requests; // book related metrics + // NOLINTNEXTLINE(build/unsigned) using metric_counter_type = uint64_t; // decltype(triggerrecordbuilderinfo::Info::pending_trigger_decisions); mutable std::atomic m_trigger_decisions_counter = { 0 }; // currently mutable std::atomic m_fragment_counter = { 0 }; // currently diff --git a/plugins/TRMonRequestorModule.cpp b/plugins/TRMonRequestorModule.cpp index 5f9217b9..89f67410 100755 --- a/plugins/TRMonRequestorModule.cpp +++ b/plugins/TRMonRequestorModule.cpp @@ -208,7 +208,7 @@ TRMonRequestorModule::send_trmon_request() } dfmessages::TRMonRequest req; - req.request_number = ++m_current_request_number; + req.request_number = ++m_current_request_number; // NOLINT(runtime/increment_decrement) req.trigger_type_mask = m_trigger_type_mask; req.run_number = *m_run_number; req.data_destination = m_reply_connection; diff --git a/plugins/TRMonRequestorModule.hpp b/plugins/TRMonRequestorModule.hpp index 46b06716..d432fd3b 100644 --- a/plugins/TRMonRequestorModule.hpp +++ b/plugins/TRMonRequestorModule.hpp @@ -87,6 +87,6 @@ class TRMonRequestorModule : public appfwk::DAQModule using metric_counter_t = std::remove_const::type; std::atomic m_trigger_records_requested{ 0 }; }; -} +} // namespace dunedaq::dfmodules #endif // DFMODULES_PLUGINS_TRMONREQUESTORMODULE_HPP_ diff --git a/schema/dfmodules/opmon/TPStreamWriter.proto b/schema/dfmodules/opmon/TPStreamWriter.proto index 44ea2a45..4ce0b006 100644 --- a/schema/dfmodules/opmon/TPStreamWriter.proto +++ b/schema/dfmodules/opmon/TPStreamWriter.proto @@ -14,7 +14,7 @@ message TPStreamWriterInfo { uint64 total_tps_written = 17; // count of TPs that have been written out in the current run uint64 total_tps_discarded = 18;// count of TPs that have been discarded in the current run -uint64 tardy_timeslice_max_seconds = 21; //incremental max amount of time that a TimeSlice was tardy + double tardy_timeslice_max_seconds = 21; //incremental max amount of time that a TimeSlice was tardy uint64 timeslices_written = 31; // incremental count of TimeSlices that have been written out uint64 bytes_output = 32; // incremental number of bytes that have been written out diff --git a/src/TPBundleHandler.cpp b/src/TPBundleHandler.cpp index ace111fa..338aae49 100644 --- a/src/TPBundleHandler.cpp +++ b/src/TPBundleHandler.cpp @@ -19,8 +19,7 @@ #include #include -namespace dunedaq { -namespace dfmodules { +namespace dunedaq::dfmodules { void TimeSliceAccumulator::add_tpset(trigger::TPSet&& tpset) @@ -98,6 +97,7 @@ TimeSliceAccumulator::get_timeslice() frag->set_window_begin(m_begin_time); frag->set_window_end(m_end_time); frag->set_element_id(sourceid); + // NOLINTNEXTLINE(build/unsigned) frag->set_detector_id(static_cast(detdataformats::DetID::Subdetector::kDAQ)); frag->set_type(daqdataformats::FragmentType::kTriggerPrimitive); @@ -140,7 +140,7 @@ TPBundleHandler::add_tpset(trigger::TPSet&& tpset) if (!m_one_or_more_time_slices_have_aged_out) { TLOG() << "Updating the slice numbers of existing accumulators by " << (1 - diff); for (auto& [local_tsidx, local_accum] : m_timeslice_accumulators) { - local_accum.update_slice_number(1 - diff); + local_accum.update_slice_number(static_cast(1 - diff)); } m_slice_index_offset -= (1 - diff); } else { @@ -208,6 +208,7 @@ TPBundleHandler::get_all_remaining_timeslices() std::vector> list_of_timeslices; for (auto& [tsidx, accum] : m_timeslice_accumulators) { + // NOLINTNEXTLINE(performance-inefficient-vector-operation) list_of_timeslices.push_back(accum.get_timeslice()); } @@ -219,5 +220,4 @@ TPBundleHandler::get_all_remaining_timeslices() return list_of_timeslices; } -} // namespace dfmodules -} // namespace dunedaq +} // namespace dunedaq::dfmodules diff --git a/src/TriggerInhibitAgent.cpp b/src/TriggerInhibitAgent.cpp index 0e7d3587..57cde6b2 100644 --- a/src/TriggerInhibitAgent.cpp +++ b/src/TriggerInhibitAgent.cpp @@ -138,7 +138,7 @@ TriggerInhibitAgent::do_work(std::atomic& running_flag) TLOG_DEBUG(TLVL_WORK_STEPS) << get_name() << ": Pushing a TriggerInhibit message with busy state set to " << inhibit_message.busy << " onto the output queue"; try { - m_trigger_inhibit_sender->send(std::move(inhibit_message), m_queue_timeout); + m_trigger_inhibit_sender->send(std::move(inhibit_message), m_queue_timeout); // NOLINT ++sent_message_count; #if 0 // temporary logging diff --git a/src/TriggerRecordBuilderData.cpp b/src/TriggerRecordBuilderData.cpp index c16948f3..74da6174 100644 --- a/src/TriggerRecordBuilderData.cpp +++ b/src/TriggerRecordBuilderData.cpp @@ -194,12 +194,13 @@ TriggerRecordBuilderData::generate_opmon_data() auto completed_trigger_records = m_complete_counter.exchange(0); if (completed_trigger_records > 0) { m_last_average_time = - 1e-6 * 0.5 * (m_min_complete_time.exchange(0) + m_max_complete_time.exchange(0)); // in seconds + 1e-6 * 0.5 * static_cast(m_min_complete_time.exchange(0) + m_max_complete_time.exchange(0)); // in seconds } if (m_last_average_time > 0.) { // prediction rate metrics - info.set_capacity_rate(0.5 * (m_busy_threshold.load() + m_free_threshold.load()) / m_last_average_time); + info.set_capacity_rate(0.5 * static_cast(m_busy_threshold.load() + m_free_threshold.load()) / + m_last_average_time); } publish(std::move(info)); diff --git a/src/dfmodules/TriggerInhibitAgent.hpp b/src/dfmodules/TriggerInhibitAgent.hpp index 4985e724..df96684c 100644 --- a/src/dfmodules/TriggerInhibitAgent.hpp +++ b/src/dfmodules/TriggerInhibitAgent.hpp @@ -27,8 +27,7 @@ #include #include -namespace dunedaq { -namespace dfmodules { +namespace dunedaq::dfmodules { /** * @brief @@ -82,7 +81,6 @@ class TriggerInhibitAgent : public utilities::NamedObject std::atomic m_trigger_number_at_start_of_processing_chain; std::atomic m_trigger_number_at_end_of_processing_chain; }; -} // namespace dfmodules -} // namespace dunedaq +} // namespace dunedaq::dfmodules #endif // DFMODULES_SRC_DFMODULES_TRIGGERINHIBITAGENT_HPP_ diff --git a/src/dfmodules/TriggerRecordBuilderData.hpp b/src/dfmodules/TriggerRecordBuilderData.hpp index f8e64913..42ea4928 100644 --- a/src/dfmodules/TriggerRecordBuilderData.hpp +++ b/src/dfmodules/TriggerRecordBuilderData.hpp @@ -121,7 +121,7 @@ class TriggerRecordBuilderData : public opmonlib::MonitorableObject using metric_t = dunedaq::dfmodules::opmon::DFApplicationInfo; using const_time_counter_t = std::invoke_result::type; using time_counter_t = std::remove_const::type; - std::atomic m_complete_counter{ 0 }; + std::atomic m_complete_counter{ 0 }; // NOLINT(build/unsigned) std::atomic m_min_complete_time{ std::numeric_limits::max() }, m_max_complete_time{ 0 }; // in us double m_last_average_time{ 0. }; diff --git a/unittest/HDF5Write_test.cxx b/unittest/HDF5Write_test.cxx index 72b11b56..af6f56a0 100644 --- a/unittest/HDF5Write_test.cxx +++ b/unittest/HDF5Write_test.cxx @@ -109,6 +109,7 @@ create_trigger_record(int trig_num, int fragment_size, int element_count) fh.sequence_number = 0; fh.fragment_type = static_cast(dunedaq::daqdataformats::FragmentType::kWIB); + // NOLINTNEXTLINE(build/unsigned) fh.detector_id = static_cast(dunedaq::detdataformats::DetID::Subdetector::kHD_TPC); fh.element_id = dunedaq::daqdataformats::SourceID(stype_to_use, ele_num); std::unique_ptr frag_ptr( diff --git a/unittest/SummaryTextWrite_test.cxx b/unittest/SummaryTextWrite_test.cxx index 39dc004b..c2ed7ae9 100644 --- a/unittest/SummaryTextWrite_test.cxx +++ b/unittest/SummaryTextWrite_test.cxx @@ -169,10 +169,11 @@ BOOST_AUTO_TEST_CASE(CheckDerivation) auto data_store_ptr = make_data_store(data_store_conf->get_type(), data_store_conf->UID(), cfg.cfgMgr, "dwm-01"); BOOST_REQUIRE(data_store_ptr != nullptr); - const auto stub_data_store_ptr{ dynamic_cast( - data_store_ptr.get()) }; // NOLINT(runtime/rtti) + // NOLINTNEXTLINE(runtime/rtti) + const auto stub_data_store_ptr{ dynamic_cast(data_store_ptr.get()) }; BOOST_REQUIRE(stub_data_store_ptr != nullptr); + // NOLINTNEXTLINE BOOST_REQUIRE_EQUAL(stub_data_store_ptr->get_derivval(), 773); // 773 should be the value in the config } diff --git a/unittest/TriggerRecordBuilderData_test.cxx b/unittest/TriggerRecordBuilderData_test.cxx index a42b6631..7c22a463 100644 --- a/unittest/TriggerRecordBuilderData_test.cxx +++ b/unittest/TriggerRecordBuilderData_test.cxx @@ -15,6 +15,7 @@ #include "boost/test/unit_test.hpp" #include +#include #include #include