$treeview $search $mathjax $extrastylesheet
artdaq_core
v3_06_01
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef artdaq_core_Core_StatisticsCollection_hh 00002 #define artdaq_core_Core_StatisticsCollection_hh 00003 00004 #include <boost/thread.hpp> 00005 #include <map> 00006 #include <memory> 00007 #include <mutex> 00008 #include "artdaq-core/Core/MonitoredQuantity.hh" 00009 00010 namespace artdaq { 00014 typedef std::shared_ptr<MonitoredQuantity> MonitoredQuantityPtr; 00015 00022 class StatisticsCollection 00023 { 00024 public: 00029 static StatisticsCollection& getInstance(); 00030 00034 virtual ~StatisticsCollection() noexcept; 00035 00041 void addMonitoredQuantity(const std::string& name, 00042 MonitoredQuantityPtr mqPtr); 00043 00049 MonitoredQuantityPtr getMonitoredQuantity(const std::string& name) const; 00050 00054 void reset(); 00055 00059 void requestStop(); 00060 00064 void run(); 00065 00066 private: 00070 explicit StatisticsCollection(); 00071 00072 // disallow any copying 00076 StatisticsCollection(StatisticsCollection const&) = delete; // not implemented 00080 void operator=(StatisticsCollection const&) = delete; // not implemented 00081 00082 StatisticsCollection(StatisticsCollection&&) = delete; 00083 StatisticsCollection& operator=(StatisticsCollection&&) = delete; 00084 00088 double calculationInterval_{1.0}; 00092 std::map<std::string, MonitoredQuantityPtr> monitoredQuantityMap_; 00093 00097 bool thread_stop_requested_; 00101 std::unique_ptr<boost::thread> calculation_thread_; 00102 00106 mutable std::mutex map_mutex_; 00107 }; 00108 } // namespace artdaq 00109 00110 #endif /* artdaq_core_Core_StatisticsCollection_hh */