Skip to content

Commit

Permalink
Update for new opmon interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mroda88 committed Jul 29, 2024
1 parent 676bb9e commit fcba40d
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ find_package(opmonlib REQUIRED)

set(IPM_DEPENDENCIES ${CETLIB} ${CETLIB_EXCEPT} ers::ers logging::logging nlohmann_json::nlohmann_json utilities::utilities opmonlib::opmonlib cppzmq pthread)

daq_protobuf_codegen( IPMInfo.proto )

#daq_add_library(Receiver.cpp Sender.cpp LINK_LIBRARIES appfwk::appfwk logging::logging cppzmq)
daq_add_library(Receiver.cpp Sender.cpp CallbackAdapter.cpp LINK_LIBRARIES ${IPM_DEPENDENCIES})

daq_add_plugin(ZmqSender duneIPM LINK_LIBRARIES ipm)
Expand Down
9 changes: 5 additions & 4 deletions include/ipm/Receiver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "cetlib/compiler_macros.h"
#include "ers/Issue.hpp"
#include "nlohmann/json.hpp"
#include "opmonlib/InfoCollector.hpp"
#include "opmonlib/MonitorableObject.hpp"

#include <atomic>
#include <memory>
Expand Down Expand Up @@ -67,7 +67,7 @@ ERS_DECLARE_ISSUE(ipm,

namespace dunedaq::ipm {

class Receiver
class Receiver : public opmonlib::MonitorableObject
{

public:
Expand Down Expand Up @@ -108,9 +108,10 @@ class Receiver
Receiver(Receiver&&) = delete;
Receiver& operator=(Receiver&&) = delete;

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

protected:

void generate_opmon_data() override ;

virtual Response receive_(const duration_t& timeout, bool no_tmoexcept_mode) = 0;

private:
Expand Down
9 changes: 5 additions & 4 deletions include/ipm/Sender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "cetlib/compiler_macros.h"
#include "ers/Issue.hpp"
#include "nlohmann/json.hpp"
#include "opmonlib/InfoCollector.hpp"
#include "opmonlib/MonitorableObject.hpp"

#include <atomic>
#include <memory>
Expand Down Expand Up @@ -65,7 +65,7 @@ ERS_DECLARE_ISSUE(ipm,

namespace dunedaq::ipm {

class Sender
class Sender : public opmonlib::MonitorableObject
{

public:
Expand Down Expand Up @@ -99,9 +99,10 @@ class Sender
Sender(Sender&&) = delete;
Sender& operator=(Sender&&) = delete;

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

protected:

void generate_opmon_data() override;

virtual bool send_(const void* message,
message_size_t N,
const duration_t& timeout,
Expand Down
16 changes: 16 additions & 0 deletions schema/ipm/IPMInfo.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";


package dunedaq.ipm.opmon;

// Information from the sender
message SenderInfo {
uint64 bytes = 1;
uint64 messages = 2;
}

// Information from the receiver
message ReceiverInfo {
uint64 bytes = 1;
uint64 messages = 2;
}
12 changes: 6 additions & 6 deletions src/Receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

#include "ipm/Receiver.hpp"
#include "ipm/receiverinfo/InfoNljs.hpp"
#include "ipm/IPMInfo.pb.h"

dunedaq::ipm::Receiver::Response
dunedaq::ipm::Receiver::receive(const duration_t& timeout, message_size_t bytes, bool no_tmoexcept_mode)
Expand All @@ -31,13 +31,13 @@ dunedaq::ipm::Receiver::receive(const duration_t& timeout, message_size_t bytes,
}

void
dunedaq::ipm::Receiver::get_info(opmonlib::InfoCollector& ci, int /*level*/)
dunedaq::ipm::Receiver::generate_opmon_data()
{

receiverinfo::Info i;
opmon::ReceiverInfo i;

i.bytes = m_bytes.exchange(0);
i.messages = m_messages.exchange(0);
i.set_bytes(m_bytes.exchange(0));
i.set_messages(m_messages.exchange(0));

ci.add(i);
publish(std::move(i));
}
12 changes: 6 additions & 6 deletions src/Sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

#include "ipm/Sender.hpp"
#include "ipm/senderinfo/InfoNljs.hpp"
#include "ipm/IPMInfo.pb.h"

#include <string>
#include <vector>
Expand Down Expand Up @@ -40,13 +40,13 @@ dunedaq::ipm::Sender::send(const void* message,
}

void
dunedaq::ipm::Sender::get_info(opmonlib::InfoCollector& ci, int /*level*/)
dunedaq::ipm::Sender::generate_opmon_data()
{

senderinfo::Info i;
opmon::SenderInfo i;

i.bytes = m_bytes.exchange(0);
i.messages = m_messages.exchange(0);
i.set_bytes(m_bytes.exchange(0));
i.set_messages(m_messages.exchange(0));

ci.add(i);
publish(std::move(i));
}

0 comments on commit fcba40d

Please sign in to comment.