ifw-ccf 6.0.0
 
Loading...
Searching...
No Matches
monitorThread.hpp
Go to the documentation of this file.
1
6
7#ifndef IFW_CCF_CTL_MONITOR_THREAD_HPP_
8#define IFW_CCF_CTL_MONITOR_THREAD_HPP_
9
10#include <boost/exception/diagnostic_information.hpp>
11
14
15
16namespace ifw::ccf::control {
17
18 constexpr auto CFG_KEY_ADPT_ACTIVE = "mon_adpt_active";
19 constexpr auto CFG_KEY_ADPT_DISABLE_DURING_ACQ = "mon_adpt_disable_during_acq";
20 constexpr auto CFG_KEY_ADPT_PERIOD = "mon_adpt_period";
21 constexpr auto CFG_KEY_DISABLE_DURING_ACQ = "disable_during_acq";
22 constexpr auto CFG_KEY_NODES_LIST_DEF = "nodes_list";
23 constexpr auto CFG_KEY_NODES = "nodes";
24 constexpr auto CFG_KEY_OLDB_NODE = "oldb_node";
25 constexpr auto CFG_KEY_META_KEY = "meta_key";
26
27 // Sentinel returned by NameMapping::GetParameterProperty() for nodes
28 // unknown to the active com adapter. When ComAdptSim::ReadUser falls
29 // through to that default, the resulting Parameter carries value
30 // "UNDEFINED" with data type STRING. HandleTelemetry treats that
31 // (value, type) pair as "no usable telemetry value" and skips the
32 // OLDB write to avoid registering a typed datapoint as a string.
33 constexpr auto TEL_UNDEFINED_VALUE = "UNDEFINED";
34
35 // Minimum interval between repeated WARN messages emitted by
36 // HandleTelemetry for the same telemetry node. The first occurrence
37 // is always logged; subsequent ones are throttled to this period.
38 constexpr double TEL_WARN_THROTTLE_PERIOD = 60.0;
39
41 std::string m_name;
42 std::string m_oldb_node;
43 std::string m_metadata_key;
44 };
45
48 ifw::core::utils::param::Parameter par;
49 };
50
55 public:
57 MonitorThread(const std::string& thread_name,
58 ifw::ccf::mptk::MessageBus& message_bus,
59 const double period = 0.1);
60
61 virtual ~MonitorThread();
62
64 void Initialise();
65
67 virtual void UserLogic();
68
69 private:
70 //void HandleTelemetry(const double time_now);
71 void CollectData();
72 void ComputePublishStatistics();
73 void CheckMessageBus();
74 void HandleNewSetup(ifw::ccf::Status status,
75 std::string& diagnostics);
76
77 void ComputeStatistics(const std::vector<double>& data_set,
78 uint16_t& samples_in_set,
79 double& mean,
80 double& min,
81 double& max,
82 double& stddev,
83 double& jitter,
84 const double theoretic_periodicty = INT_MIN);
85
86 std::list<std::string> m_thread_names;
87 std::map<std::string, ifw::ccf::common::FrameStatistics> m_thr_name_to_frame_stat;
88 std::map<std::string, double> m_thread_drift;
89 std::map<uint64_t, double> m_thread_drift_window;
90 uint64_t m_drift_count;
91 double m_mon_last_rec_wait_clean_up;
92
93 // Monitor Adapter parameters.
94 bool m_mon_adpt_active;
95 bool m_mon_adpt_disable_during_acq;
96 double m_mon_adpt_period;
97
98 double m_time_last_mon_adpt_exec;
99
100 // bool m_tel_enabled{false};
101 // double m_tel_period{0};
102 // bool m_disable_during_acq{true};
103 // std::map<std::string, ifw::ccf::control::TelemetryNode> m_tel_nodes;
104 // std::vector<std::string> m_tel_names;
105 // double m_time_last_tel_sampling_exec{0};
106 };
107
108}
109
110#endif // IFW_CCF_CTL_MONITOR_THREAD_HPP_
virtual ~MonitorThread()
Definition monitorThread.cpp:25
virtual void UserLogic()
Monitor Thread user logic.
Definition monitorThread.cpp:40
void Initialise()
Initialise the thread. This is invoked after creation.
Definition monitorThread.cpp:29
MonitorThread(const std::string &thread_name, ifw::ccf::mptk::MessageBus &message_bus, const double period=0.1)
See ifw::ccf::mptk::Thread.
Definition monitorThread.cpp:15
IFW CTD Multiprocessing Toolkit Message Bus.
Definition messageBus.hpp:92
IFW CTD Multiprocessing Toolkit Thread base class.
Definition thread.hpp:31
Definition acqThread.cpp:11
constexpr auto CFG_KEY_ADPT_DISABLE_DURING_ACQ
Definition monitorThread.hpp:19
constexpr auto CFG_KEY_NODES_LIST_DEF
Definition monitorThread.hpp:22
constexpr auto CFG_KEY_OLDB_NODE
Definition monitorThread.hpp:24
constexpr auto CFG_KEY_DISABLE_DURING_ACQ
Definition monitorThread.hpp:21
constexpr auto CFG_KEY_NODES
Definition monitorThread.hpp:23
constexpr auto TEL_UNDEFINED_VALUE
Definition monitorThread.hpp:33
constexpr auto CFG_KEY_ADPT_PERIOD
Definition monitorThread.hpp:20
constexpr double TEL_WARN_THROTTLE_PERIOD
Definition monitorThread.hpp:38
constexpr auto CFG_KEY_ADPT_ACTIVE
Definition monitorThread.hpp:18
constexpr auto CFG_KEY_META_KEY
Definition monitorThread.hpp:25
Status
General status variable.
Definition base.hpp:158
Definition monitorThread.hpp:46
ifw::core::utils::param::Parameter par
Definition monitorThread.hpp:48
TelemetryNode node
Definition monitorThread.hpp:47
Definition monitorThread.hpp:40
std::string m_metadata_key
Definition monitorThread.hpp:43
std::string m_name
Definition monitorThread.hpp:41
std::string m_oldb_node
Definition monitorThread.hpp:42