5 #include <unordered_map>
11 #include "Mu2e-STMDAQ/utils/async_logger.hh"
13 #include "Mu2e-STMDAQ/utils/signal_handler.hh"
15 #include "Mu2e-STMDAQ/buffers/data_struct.hh"
17 #include "Mu2e-STMDAQ/dqm/dqm_shm_block.hh"
18 #include "Mu2e-STMDAQ/dqm/shm_manager.hh"
20 #include "Mu2e-STMDAQ/processing/operations_base.hh"
24 namespace interprocess {
25 class shared_memory_object;
41 const std::shared_ptr<AsyncLogger>& logger,
42 const std::shared_ptr<STMdata>& stm_,
43 const std::shared_ptr<SignalHandler>& signal_,
48 logger->log(
"DQM destructor called.",1);
57 void registerBlock(DQMPageType type,
const std::string& shm_name,
size_t size);
61 T* get(DQMPageType type);
69 const std::shared_ptr<AsyncLogger>& logger;
72 const std::shared_ptr<STMdata>& stm;
75 const std::shared_ptr<SignalHandler>& signal;
81 const double baseline_mean_prev;
82 const double baseline_sigma_prev;
85 size_t baseline_nbins;
99 std::vector<uint64_t> peak_hist_window;
101 std::vector<uint64_t> peak_hist_all;
104 const size_t window_size_buffers;
106 uint64_t total_window = 0;
107 uint64_t total_all = 0;
110 std::vector<std::vector<uint64_t>> per_buffer_hists;
111 std::size_t window_index = 0;
114 size_t num_dropped_packets;
120 void alarm_info(std::shared_ptr<DataStruct>& buffer);
123 void histogram_peaks(std::shared_ptr<DataStruct>& buffer);
126 void update_dqm(std::shared_ptr<DataStruct>& buffer);
129 void update_dqm_baseline(std::shared_ptr<DataStruct>& buffer);
132 void update_dqm_raw(std::shared_ptr<DataStruct>& buffer);
135 void update_dqm_peak(std::shared_ptr<DataStruct>& buffer);
138 void update_cpu_performance(std::shared_ptr<DataStruct>& buffer);
141 uint64_t get_current_time_ns();
144 std::unordered_map<DQMPageType, std::unique_ptr<DQMBlockBase>> blocks_;
146 std::thread updater_;
148 std::atomic<bool> running_;
154 #include "Mu2e-STMDAQ/dqm/dqm_manager.tpp"