Skip to content

Commit

Permalink
Merge pull request #140 from DUNE-DAQ/feature/opmon
Browse files Browse the repository at this point in the history
restore compilability
  • Loading branch information
glehmannmiotto authored Aug 14, 2024
2 parents 75e0d9f + 1acbe72 commit 218adc9
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 77 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ find_package(Boost COMPONENTS unit_test_framework REQUIRED)
find_package(fmt REQUIRED)

daq_codegen( nicsender.jsonnet nicreader.jsonnet TEMPLATES Structs.hpp.j2 Nljs.hpp.j2 )
daq_codegen( *info.jsonnet DEP_PKGS opmonlib TEMPLATES opmonlib/InfoStructs.hpp.j2 opmonlib/InfoNljs.hpp.j2 )

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")

Expand Down
17 changes: 7 additions & 10 deletions plugins/DPDKReaderModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@
#include "dpdklibs/udp/Utils.hpp"
#include "dpdklibs/udp/PacketCtor.hpp"
#include "dpdklibs/FlowControl.hpp"
#include "dpdklibs/receiverinfo/InfoNljs.hpp"
#include "CreateSource.hpp"
#include "DPDKReaderModule.hpp"

#include "opmonlib/InfoCollector.hpp"

#include <cinttypes>
#include <chrono>
#include <sstream>
Expand Down Expand Up @@ -301,13 +298,13 @@ DPDKReaderModule::do_scrap(const data_t&)
}
}

void
DPDKReaderModule::get_info(opmonlib::InfoCollector& ci, int level)
{
for (auto& [iface_id, iface] : m_ifaces) {
iface->get_info(ci, level);
}
}
// void
// DPDKReaderModule::get_info(opmonlib::InfoCollector& ci, int level)
// {
// for (auto& [iface_id, iface] : m_ifaces) {
// iface->get_info(ci, level);
// }
// }

void
DPDKReaderModule::set_running(bool should_run)
Expand Down
5 changes: 3 additions & 2 deletions plugins/DPDKReaderModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "datahandlinglibs/utils/ReusableThread.hpp"

//#include "dpdklibs/nicreader/Structs.hpp"
//#include "dpdklibs/nicreaderinfo/InfoNljs.hpp"
#include "dpdklibs/EALSetup.hpp"
#include "IfaceWrapper.hpp"

Expand Down Expand Up @@ -61,7 +60,9 @@ class DPDKReaderModule : public dunedaq::appfwk::DAQModule
void do_start(const data_t&);
void do_stop(const data_t&);
void do_scrap(const data_t&);
void get_info(opmonlib::InfoCollector& ci, int level);

#warning MISSING OPMON
//void get_info(opmonlib::InfoCollector& ci, int level);

// Internals
std::shared_ptr<appfwk::ModuleConfiguration> m_cfg;
Expand Down
103 changes: 51 additions & 52 deletions src/IfaceWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "dpdklibs/Issues.hpp"

#include "dpdklibs/nicreader/Structs.hpp"
#include "dpdklibs/nicreaderinfo/InfoNljs.hpp"

#include "dpdklibs/EALSetup.hpp"
#include "dpdklibs/FlowControl.hpp"
Expand Down Expand Up @@ -300,57 +299,57 @@ IfaceWrapper::scrap()


//-----------------------------------------------------------------------------
void
IfaceWrapper::get_info(opmonlib::InfoCollector& ci, int level)
{

nicreaderinfo::EthStats s;
s.ipackets = m_iface_xstats.m_eth_stats.ipackets;
s.opackets = m_iface_xstats.m_eth_stats.opackets;
s.ibytes = m_iface_xstats.m_eth_stats.ibytes;
s.obytes = m_iface_xstats.m_eth_stats.obytes;
s.imissed = m_iface_xstats.m_eth_stats.imissed;
s.ierrors = m_iface_xstats.m_eth_stats.ierrors;
s.oerrors = m_iface_xstats.m_eth_stats.oerrors;
s.rx_nombuf = m_iface_xstats.m_eth_stats.rx_nombuf;
ci.add(s);

// Empty stat JSON placeholder
nlohmann::json stat_json;

// Poll stats from HW
m_iface_xstats.poll();

// Build JSON from values
for (int i = 0; i < m_iface_xstats.m_len; ++i) {
stat_json[m_iface_xstats.m_xstats_names[i].name] = m_iface_xstats.m_xstats_values[i];
}

// Reset HW counters
m_iface_xstats.reset_counters();

// Convert JSON to NICReaderInfo struct
nicreaderinfo::EthXStats xs;
nicreaderinfo::from_json(stat_json, xs);

// Push to InfoCollector
ci.add(xs);
TLOG_DEBUG(TLVL_WORK_STEPS) << "opmonlib::InfoCollector object passed by reference to IfaceWrapper::get_info"
<< " -> Result looks like the following:\n" << ci.get_collected_infos();

for( const auto& [src_rx_q,_] : m_num_frames_rxq) {
nicreaderinfo::QueueStats qs;
qs.packets_received = m_num_frames_rxq[src_rx_q].load();
qs.bytes_received = m_num_bytes_rxq[src_rx_q].load();
qs.full_rx_burst = m_num_full_bursts[src_rx_q].load();
qs.max_burst_size = m_max_burst_size[src_rx_q].exchange(0);

opmonlib::InfoCollector queue_ci;
queue_ci.add(qs);

ci.add(fmt::format("queue_{}", src_rx_q), queue_ci);
}
}
// void
// IfaceWrapper::get_info(opmonlib::InfoCollector& ci, int level)
// {

// nicreaderinfo::EthStats s;
// s.ipackets = m_iface_xstats.m_eth_stats.ipackets;
// s.opackets = m_iface_xstats.m_eth_stats.opackets;
// s.ibytes = m_iface_xstats.m_eth_stats.ibytes;
// s.obytes = m_iface_xstats.m_eth_stats.obytes;
// s.imissed = m_iface_xstats.m_eth_stats.imissed;
// s.ierrors = m_iface_xstats.m_eth_stats.ierrors;
// s.oerrors = m_iface_xstats.m_eth_stats.oerrors;
// s.rx_nombuf = m_iface_xstats.m_eth_stats.rx_nombuf;
// ci.add(s);

// // Empty stat JSON placeholder
// nlohmann::json stat_json;

// // Poll stats from HW
// m_iface_xstats.poll();

// // Build JSON from values
// for (int i = 0; i < m_iface_xstats.m_len; ++i) {
// stat_json[m_iface_xstats.m_xstats_names[i].name] = m_iface_xstats.m_xstats_values[i];
// }

// // Reset HW counters
// m_iface_xstats.reset_counters();

// // Convert JSON to NICReaderInfo struct
// nicreaderinfo::EthXStats xs;
// nicreaderinfo::from_json(stat_json, xs);

// // Push to InfoCollector
// ci.add(xs);
// TLOG_DEBUG(TLVL_WORK_STEPS) << "opmonlib::InfoCollector object passed by reference to IfaceWrapper::get_info"
// << " -> Result looks like the following:\n" << ci.get_collected_infos();

// for( const auto& [src_rx_q,_] : m_num_frames_rxq) {
// nicreaderinfo::QueueStats qs;
// qs.packets_received = m_num_frames_rxq[src_rx_q].load();
// qs.bytes_received = m_num_bytes_rxq[src_rx_q].load();
// qs.full_rx_burst = m_num_full_bursts[src_rx_q].load();
// qs.max_burst_size = m_max_burst_size[src_rx_q].exchange(0);

// opmonlib::InfoCollector queue_ci;
// queue_ci.add(qs);

// ci.add(fmt::format("queue_{}", src_rx_q), queue_ci);
// }
// }

//-----------------------------------------------------------------------------
void
Expand Down
7 changes: 3 additions & 4 deletions src/IfaceWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
//#include "dpdklibs/nicreader/Structs.hpp"
#include "confmodel/NetworkDevice.hpp"

#include "dpdklibs/nicreaderinfo/InfoNljs.hpp"

#include "dpdklibs/EALSetup.hpp"
#include "dpdklibs/udp/Utils.hpp"
#include "dpdklibs/udp/PacketCtor.hpp"
Expand Down Expand Up @@ -56,8 +54,9 @@ class IfaceWrapper
//void init();
void start();
void stop();

void get_info(opmonlib::InfoCollector& ci, int level);

#warning MISSING OPMON
// void get_info(opmonlib::InfoCollector& ci, int level);

void allocate_mbufs();
void setup_interface();
Expand Down
15 changes: 7 additions & 8 deletions src/SourceModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include <mutex>
#include <string>

#include "dpdklibs/nicreaderinfo/InfoNljs.hpp"


namespace dunedaq::dpdklibs {

Expand Down Expand Up @@ -108,12 +106,13 @@ class SourceModel : public SourceConcept
return true;
}

void get_info(opmonlib::InfoCollector& ci, int /*level*/) {
nicreaderinfo::SourceStats ss;
ss.dropped_frames = m_dropped_packets.load();
ci.add(ss);
}

#warning MISSING OPMON
// void get_info(opmonlib::InfoCollector& ci, int /*level*/) {
// nicreaderinfo::SourceStats ss;
// ss.dropped_frames = m_dropped_packets.load();
// ci.add(ss);
// }

private:
// Sink internals
std::string m_sink_id;
Expand Down

0 comments on commit 218adc9

Please sign in to comment.