PhoenixSwarm  5.1.1
Library to ease communication between daemons
Loading...
Searching...
No Matches
Monitoring_impl.h
Go to the documentation of this file.
1/***************************************
2 Auteur : Thibaut Oprinsen
3 Mail : thibaut.oprinsen@lapp.in2p3.fr
4 Licence : CeCILL-C
5****************************************/
6#ifndef __Monitoring_IMPL_H__
7#define __Monitoring_IMPL_H__
8
9#include "StatSort.h"
10#include "Monitoring.h"
11
12using namespace Swarm;
13
15template<class _TBackend>
21
23template<class _TBackend>
27
29
31template<class _TBackend>
35
37
39template<class _TBackend>
41 return !p_mapDaemonStat.empty();
42}
43
45
47template<class _TBackend>
49 return p_mapDaemonStat.size();
50}
51
53
55template<class _TBackend>
59
61
63template<class _TBackend>
67
69
72template<class _TBackend>
73PUncastableBool Monitoring<_TBackend>::fillStatInfo(const Swarm::Stat & stat) {
74 p_mapDaemonStat[stat.getName()] = stat;
75 return UNCASTABLE_TRUE;
76}
77
79
82template<class _TBackend>
83bool Monitoring<_TBackend>::extraLoad(const ConfigNode * config){
84 if(config != nullptr){
85 p_statBufferDuration = phoenix_get_value<size_t>(*config, "stat_buffer_duration_second", 30lu);
86 p_binDuration = phoenix_get_value<size_t>(*config, "bin_duration_second", 5lu);
87 }
88 return true;
89}
90
92template<class _TBackend>
98
100
102template<class _TBackend>
104 // bool bResult = Daemon<_TBackend>::sendValue("SwarmTop", p_mapDaemonStat);
105 return true;
106}
107
109template<class _TBackend>
112 BaseDaemon::getLog().getLogInfo() << "Monitoring: Adding data callable method for stat sorting with nbBin=" << daemonConfig.getStatNbBin() << ", lowerBound=" << daemonConfig.getStatHistLowerBound() << ", upperBound=" << daemonConfig.getStatHistUpperBound() << std::endl;
114}
115
116#endif
std::map< PString, Swarm::Stat > MapDaemonStat
Definition Monitoring.h:15
PUncastableBool sortFillDaemonStat(Monitoring< _TBackend > &manager, const Swarm::Stat &data)
bool addDataCallableMethod(PUncastableBool(&function)(const _Data &), size_t nbBin, float histLowerBound, float histUpperBound)
Add a callable method of the Daemon.
Definition BaseDaemon.h:105
DaemonConfig & getConfig()
Get the configuration of the current BaseDaemon.
PLog & getLog()
Get the log of the current BaseDaemon.
Describe a Daemon of the Swarm.
size_t getStatNbBin() const
Gets the statNbBin of the DaemonConfig.
float getStatHistLowerBound() const
Gets the statHistLowerBound of the DaemonConfig.
float getStatHistUpperBound() const
Gets the statHistUpperBound of the DaemonConfig.
Daemon()
Default constructor of Daemon.
Definition Daemon_impl.h:17
Monitoring()
Constructor of Monitoring.
size_t getStatBinDurationSecond() const
Get the duration of a bin in seconds for the histogram of the statistics.
bool extraLoad(const ConfigNode *config)
Override for loading extra parameters for the Monitoring.
size_t p_statBufferDuration
Buffer duration in seconds for the statistics accumulation period.
Definition Monitoring.h:37
bool hasReceivedStats() const
Check if stats have been received.
size_t p_binDuration
Duration of a bin in seconds for stat accumulation.
Definition Monitoring.h:39
const MapDaemonStat & getMapDaemonStat() const
Get the map of Stat.
virtual ~Monitoring()
Destructor of Monitoring.
PUncastableBool fillStatInfo(const Swarm::Stat &stat)
Fill the StatInfo of the Monitoring with the given Stat.
size_t getStatsCount() const
Get the count of stats received.
virtual void addCallMethod()
Method from BaseDaemon to add call methods.
void initializeMonitoring()
Initialize the Monitoring.
MapDaemonStat p_mapDaemonStat
Statistics about all Daemon in the swarm.
Definition Monitoring.h:41
size_t getStatBufferDurationSecond() const
Get the buffer duration in seconds for the statistics accumulation period.
bool processEvent()
Process event.
Statistics of a Daemon.
const PString & getName() const
Gets the name of the Stat.