PhoenixSwarm  3.5.0
Library to ease communication between daemons
Loading...
Searching...
No Matches
StatDaemonManager< _TBackend > Class Template Reference

Daemon which manages statistics of a full swarm. More...

#include <StatDaemonManager.h>

+ Inheritance diagram for StatDaemonManager< _TBackend >:
+ Collaboration diagram for StatDaemonManager< _TBackend >:

Public Member Functions

template<typename _Callable>
bool addCallableMethod (_Callable &&function, const PString &name)
 Add a callable method of the Daemon.
 
virtual void addCallMethod ()
 Method from BaseDaemon to add call methods.
 
template<typename _Class, typename _Data>
bool addDataCallableMethod (PUncastableBool(&function)(_Class &, const _Data &), _Class &persistentData, size_t nbBin, float histLowerBound, float histUpperBound)
 Add a callable method of the Daemon.
 
template<typename _Data>
bool addDataCallableMethod (PUncastableBool(&function)(const _Data &), size_t nbBin, float histLowerBound, float histUpperBound)
 Add a callable method of the Daemon.
 
void addMessageToConfirm (const Message &message)
 Add a message to confirm.
 
bool callMethod (Data &result, const PString &name, const Data &parameter)
 Call an added callable method by name.
 
void checkMessageTimeout (time_t currentTime)
 Check if a message has reached the timeout.
 
PRecvStatus::PRecvStatus checkRecvStatus (PRecvStatus::PRecvStatus recvStatus)
 Check the status of recv sockets.
 
void checkSendStatus (PSendStatus::PSendStatus sendStatus)
 Check the status of recv sockets.
 
void clearCallableMethod ()
 Clear the map of callable methods.
 
void clearStat ()
 Clear all the statistics of the daemon.
 
StatAccumulator createNewStat (size_t nbBin, float histLowerBound, float histUpperBound)
 Create a new clear computing statistic.
 
virtual void executeOnStop ()
 Method which is called on stop of the Daemon.
 
virtual bool extraLoad (const ConfigNode *config)
 Extra call on load for the current Daemon.
 
virtual void extraLoopProcessing ()
 Computing Method for each event loop (when receiving message from other Daemon)
 
PUncastableBool fillStatInfo (const DaemonStat &stat)
 Fill the StatInfo of the StatDaemonManager with the given DaemonStat.
 
DaemonConfiggetConfig ()
 Get the configuration of the current BaseDaemon.
 
AbstractDataFunctiongetDataFunction (const Data &data)
 Get the data function associated with the given data.
 
PLog & getLog ()
 Get the log of the current BaseDaemon.
 
PLog & getLogger ()
 Get the logger of the current BaseDaemon.
 
DaemonMainConfiggetMainConfig ()
 Get the main configuration of the swarm.
 
MapDaemonConfiggetMapDaemonConfig ()
 Get the map of all Daemon configurations.
 
const MapDaemonStatgetMapDaemonStat () const
 Get the map of DaemonStat.
 
const std::map< size_t, Message > & getMapMessageToBeConfirmed () const
 Get the map of message to be confirmed.
 
size_t getMessageId ()
 Get current message id.
 
bool getMessageToConfirm (Message &message, size_t id) const
 Get a message to confirm by id if it exists.
 
OptionParser & getOptionParser ()
 Return the OptionParser of the current BaseDaemon.
 
size_t getStatsCount () const
 Get the count of stats received.
 
bool hasReceivedStats () const
 Check if stats have been received.
 
bool isDaemonExist (const PString &name) const
 Say if a neighbour Daemon does exist.
 
bool load (const PPath &fileName, const PString &daemonName)
 Load the Toml configuration which define all BaseDaemons of the Swarm.
 
bool load (const PString &configFileContent, const PString &daemonName, ConfigFormat::ConfigFormat format)
 Load the Json configuration which define all BaseDaemons of the Swarm.
 
void loadConfigFromNode (const ConfigNode &dico, const PString &daemonName)
 Load configuration form a node of ConfigNode.
 
bool parseArgument (int argc, char **argv)
 Parse arguments given to the BaseDaemon with command line.
 
void processConfirmedMessage (size_t id, time_t currentTime)
 Process confirmed message.
 
bool processData (const Data &data)
 Process given data with the proper method.
 
bool processEvent ()
 Process event.
 
bool run ()
 Run the Daemon.
 
bool sendData (const PString &destinationName, const Data &data, bool isConfirmationNeeded)
 Send data to other Daemon (specialization for Data)
 
bool sendMessage (const Message &message)
 Send message to other Daemon.
 
bool sendMessage (const PString &destinationName, const Message &message)
 Send message to other Daemon.
 
template<typename T>
bool sendValue (const PString &destinationName, const T &data, bool isConfirmationNeeded=true)
 Send data to other Daemon.
 
void setClockMode (PClockMode::PClockMode mode)
 Set the mode of the clock.
 
void setSocketMode (PSocketMode::PSocketMode mode)
 Set the mode of the sockets of the SocketManager.
 
 StatDaemonManager ()
 Constructor of StatDaemonManager.
 
void stop ()
 Stops the BaseDaemon.
 
void updateStatAccumulator (StatAccumulator &stat, float value)
 Update a computing statistic with a new value.
 
virtual ~StatDaemonManager ()
 Destructor of StatDaemonManager.
 

Protected Member Functions

void fillDaemonStat (DaemonStat &stat, time_t startTimestamp, time_t endTimestamp)
 Fill the DaemonStat with the current statistics of the daemon.
 
VecStat fillVecStat (const StatAccumulator &accumulator, time_t startTimestamp, time_t endTimestamp)
 Fill a VecStat from a StatAccumulator to send to the DamonStat.
 
void processInputMessage (Message &message)
 Process an input message.
 

Protected Attributes

_TBackend p_backend
 Full backend of the Daemon (for Socket and clock)
 
DaemonConfig p_config
 Configuration of the curent Daemon.
 
bool p_isFullMock
 True if the daemon has to be executed in mock mode for socket and clock.
 
bool p_isFullMockRecord
 True if the daemon has to be executed in mock record mode for socket and clock.
 
bool p_isRun
 True if the current BaseDaemon is running.
 
PLog p_log
 Logger of the current Daemon.
 
DaemonMainConfig p_mainConfig
 Main configuration of the Daemon.
 
MapDaemonConfig p_mapDaemon
 Map of the other Daemon of the Swarm.
 
time_t p_startTimestamp
 Start timestamp of the current accumulation of statistics.
 
PTimer p_statTimer
 Timer to send statistics to the Stat Daemon.
 

Private Member Functions

std::map< PString, StatAccumulatorcreateNewCommunicationStatMap (const PString &dataType, size_t nbBin, float histLowerBound, float histUpperBound)
 Create a new map of communication statistic.
 
void getCommunicationStat (const PString &destName, const PString &dataType, float latency, size_t nbBin, float histLowerBound, float histUpperBound)
 Add a communication statistic.
 
void initialisationBaseDaemon ()
 Initialisation function of the class BaseDaemon.
 
void initialisationDaemon ()
 Initialisation function of the class Daemon.
 
void initialisationDaemonSocket ()
 Initialise the Daemon Sockets.
 
void initializeStatDaemonManager ()
 Initialize the StatDaemonManager.
 
void sendStatToStatDaemon (time_t currentTime)
 Send the statistics of the Daemon to the Stat Daemon.
 

Private Attributes

std::map< PString, AbstractFunction * > p_mapCallableMethod
 Map of callable method of the Daemon.
 
MapDaemonStat p_mapDaemonStat
 Statistics about all Daemon in the swarm.
 
std::map< PString, AbstractDataFunction * > p_mapDataFunction
 Map of methods which have to be called when receiving data.
 
std::map< size_t, Messagep_mapMessageToBeConfirmed
 Map of messages which have to be confirmed by destination Daemon.
 
size_t p_messageId
 Id counter of the message of the current Daemon.
 
OptionParser p_optionParser
 Option parser of the Daemon.
 

Detailed Description

template<class _TBackend>
class StatDaemonManager< _TBackend >

Daemon which manages statistics of a full swarm.

Definition at line 18 of file StatDaemonManager.h.

Constructor & Destructor Documentation

◆ StatDaemonManager()

template<class _TBackend>
StatDaemonManager< _TBackend >::StatDaemonManager ( )

Constructor of StatDaemonManager.

Definition at line 14 of file StatDaemonManager_impl.h.

16{
18}
Daemon()
Default constructor of Daemon.
Definition Daemon_impl.h:15
void initializeStatDaemonManager()
Initialize the StatDaemonManager.

References Daemon< _TBackend >::Daemon(), and initializeStatDaemonManager().

+ Here is the call graph for this function:

◆ ~StatDaemonManager()

template<class _TBackend>
StatDaemonManager< _TBackend >::~StatDaemonManager ( )
virtual

Destructor of StatDaemonManager.

Definition at line 22 of file StatDaemonManager_impl.h.

22 {
23
24}

Member Function Documentation

◆ addCallableMethod()

template<typename _Callable>
bool BaseDaemon::addCallableMethod ( _Callable && function,
const PString & name )
inlineinherited

Add a callable method of the Daemon.

Parameters
function: method to be added
name: name of the method which can be called
Returns
true on success, false otherwise

Definition at line 73 of file BaseDaemon.h.

73 {
74 std::map<PString, AbstractFunction*>::iterator it(p_mapCallableMethod.find(name));
75 if(it != p_mapCallableMethod.end()){
76 getLog().getLogError() << "BaseDaemon::addCallableMethod : function '"<<name<<"' already added" << std::endl;
77 return false;
78 }
79 p_mapCallableMethod[name] = new FunctionCall(function, name);
80 return true;
81 }
std::map< PString, AbstractFunction * > p_mapCallableMethod
Map of callable method of the Daemon.
Definition BaseDaemon.h:182
PLog & getLog()
Get the log of the current BaseDaemon.

References getLog(), and p_mapCallableMethod.

+ Here is the call graph for this function:

◆ addCallMethod()

template<class _TBackend>
void StatDaemonManager< _TBackend >::addCallMethod ( )
virtual

Method from BaseDaemon to add call methods.

Reimplemented from BaseDaemon.

Definition at line 77 of file StatDaemonManager_impl.h.

77 {
79 BaseDaemon::getLog().getLogInfo() << "StatDaemonManager: Adding data callable method for stat sorting with nbBin=" << daemonConfig.getStatNbBin() << ", lowerBound=" << daemonConfig.getStatHistLowerBound() << ", upperBound=" << daemonConfig.getStatHistUpperBound() << std::endl;
80 Daemon<_TBackend>::addDataCallableMethod(sortFillDaemonStat<_TBackend>, *this, daemonConfig.getStatNbBin(), daemonConfig.getStatHistLowerBound(), daemonConfig.getStatHistUpperBound());
81}
DaemonConfig & getConfig()
Get the configuration of the current BaseDaemon.
bool addDataCallableMethod(PUncastableBool(&function)(const _Data &), size_t nbBin, float histLowerBound, float histUpperBound)
Add a callable method of the Daemon.
Definition BaseDaemon.h:105
Daemon which manages statistics of a full swarm.

References BaseDaemon::addDataCallableMethod(), BaseDaemon::getConfig(), BaseDaemon::getLog(), DaemonConfig::getStatHistLowerBound(), DaemonConfig::getStatHistUpperBound(), DaemonConfig::getStatNbBin(), and sortFillDaemonStat().

+ Here is the call graph for this function:

◆ addDataCallableMethod() [1/2]

template<typename _Class, typename _Data>
bool BaseDaemon::addDataCallableMethod ( PUncastableBool(&)(_Class &, const _Data &) function,
_Class & persistentData,
size_t nbBin,
float histLowerBound,
float histUpperBound )
inlineinherited

Add a callable method of the Daemon.

Parameters
function: method to be added
persistentData: data used each time the method is called
nbBin: number of bin in the histogram
histLowerBound: lower bound of the histogram
histUpperBound: upper bound of the histogram
Returns
true on success, false otherwise

Definition at line 128 of file BaseDaemon.h.

128 {
129 PString prototype(phoenix_getTypeToStr<_Data>());
130 std::cout << "BaseDaemon::addDataCallableMethod : prototype = " << prototype << std::endl;
131 std::map<PString, AbstractDataFunction*>::iterator it(p_mapDataFunction.find(prototype));
132 if(it != p_mapDataFunction.end()){
133 getLog().getLogError() << "BaseDaemon::addDataCallableMethod : function to process data '"<<prototype<<"' already added" << std::endl;
134 return false;
135 }
136 getLog().getLogDebug() << "BaseDaemon::addDataCallableMethod : add method to process data '"<<prototype<<"'" << std::endl;
137 p_mapDataFunction[prototype] = new DataFunctionClassCall(function, persistentData, prototype);
138 p_config.getDaemonStatAccumulator().getMapStatComputing()[prototype] = createNewStat(nbBin, histLowerBound, histUpperBound);
139 return true;
140 }
std::map< PString, AbstractDataFunction * > p_mapDataFunction
Map of methods which have to be called when receiving data.
Definition BaseDaemon.h:189
DaemonConfig p_config
Configuration of the curent Daemon.
Definition BaseDaemon.h:162
StatAccumulator createNewStat(size_t nbBin, float histLowerBound, float histUpperBound)
Create a new clear computing statistic.

References createNewStat(), getLog(), p_config, and p_mapDataFunction.

+ Here is the call graph for this function:

◆ addDataCallableMethod() [2/2]

template<typename _Data>
bool BaseDaemon::addDataCallableMethod ( PUncastableBool(&)(const _Data &) function,
size_t nbBin,
float histLowerBound,
float histUpperBound )
inlineinherited

Add a callable method of the Daemon.

Parameters
function: method to be added
nbBin: number of bin in the histogram
histLowerBound: lower bound of the histogram
histUpperBound: upper bound of the histogram
Returns
true on success, false otherwise

Definition at line 105 of file BaseDaemon.h.

105 {
106 PString prototype(phoenix_getTypeToStr<_Data>());
107 std::cout << "BaseDaemon::addDataCallableMethod : prototype = " << prototype << std::endl;
108 std::map<PString, AbstractDataFunction*>::iterator it(p_mapDataFunction.find(prototype));
109 if(it != p_mapDataFunction.end()){
110 getLog().getLogError() << "BaseDaemon::addDataCallableMethod : function to process data '"<<prototype<<"' already added" << std::endl;
111 return false;
112 }
113 getLog().getLogDebug() << "BaseDaemon::addDataCallableMethod : add method to process data '"<<prototype<<"'" << std::endl;
114 p_mapDataFunction[prototype] = new DataFunctionCall(function, prototype);
115 p_config.getDaemonStatAccumulator().getMapStatComputing()[prototype] = createNewStat(nbBin, histLowerBound, histUpperBound);
116 return true;
117 }

References createNewStat(), getLog(), p_config, and p_mapDataFunction.

Referenced by StatDaemonManager< _TBackend >::addCallMethod().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMessageToConfirm()

void BaseDaemon::addMessageToConfirm ( const Message & message)
inherited

Add a message to confirm.

Parameters
message: message to be added

Definition at line 180 of file BaseDaemon.cpp.

180 {
181 p_mapMessageToBeConfirmed[message.getId()] = message;
182}
std::map< size_t, Message > p_mapMessageToBeConfirmed
Map of messages which have to be confirmed by destination Daemon.
Definition BaseDaemon.h:184
size_t getId() const
Gets the id of the Message.

References Message::getId(), and p_mapMessageToBeConfirmed.

Referenced by Daemon< _TBackend >::sendMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ callMethod()

bool BaseDaemon::callMethod ( Data & result,
const PString & name,
const Data & parameter )
inherited

Call an added callable method by name.

Parameters
[out]result: result of the call
name: name of the method
parameter: parameters of the call
Returns
true on success, false otherwise

Definition at line 121 of file BaseDaemon.cpp.

121 {
122 std::map<PString, AbstractFunction*>::iterator it(p_mapCallableMethod.find(name));
123 if(it == p_mapCallableMethod.end()){
124 getLog().getLogError() << "BaseDaemon::callMethod : function '"<<name<<"' not found" << std::endl;
125 return false;
126 }
127 return p_mapCallableMethod[name]->call(p_log, result, parameter);
128}
PLog p_log
Logger of the current Daemon.
Definition BaseDaemon.h:166

References getLog(), p_log, and p_mapCallableMethod.

+ Here is the call graph for this function:

◆ checkMessageTimeout()

void BaseDaemon::checkMessageTimeout ( time_t currentTime)
inherited

Check if a message has reached the timeout.

Parameters
currentTime: current time

Definition at line 223 of file BaseDaemon.cpp.

223 {
224 std::vector<size_t> messagesToRemove;
225 for(auto it = p_mapMessageToBeConfirmed.begin(); it != p_mapMessageToBeConfirmed.end(); ++it){
226 const size_t & messageId = it->first;
227 const Message & message = it->second;
228 time_t elapsedTime = currentTime - message.getSendTime();
229 if(message.getVecRecver().size() == 0lu){
230 getLog().getLogError() << "BaseDaemon::checkMessageTimeout() : message " << messageId << " has no receiver." << std::endl;
231 continue;
232 }
233 std::map<PString, time_t>::const_iterator timeoutIt = p_config.getMapTimeout().find(message.getVecRecver().front());
234 if(timeoutIt == p_config.getMapTimeout().end()){
235 getLog().getLogError() << "BaseDaemon::checkMessageTimeout() : no timeout found for receiver '" << message.getVecRecver().front() << "' of message " << messageId << "." << std::endl;
236 continue;
237 }
238 time_t timeout = timeoutIt->second;
239 phoenix_assert(message.getVecRecver().size() != 0lu);
240 if (elapsedTime > timeout) {
241 messagesToRemove.push_back(messageId);
242 getLog().getLogWarning() << "BaseDaemon::checkMessageTimeout() : Timeout Reached for message " << messageId << " sent to '" << message.getVecRecver().front() << "'. Removing unconfirmed transaction" << std::endl;
243 }
244 }
245 for(const size_t & messageId : messagesToRemove){
246 p_mapMessageToBeConfirmed.erase(messageId);
247 }
248}
const std::vector< PString > & getVecRecver() const
Gets the vecRecver of the Message.
const time_t & getSendTime() const
Gets the sendTime of the Message.

References getLog(), Message::getSendTime(), Message::getVecRecver(), p_config, and p_mapMessageToBeConfirmed.

Referenced by Daemon< _TBackend >::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkRecvStatus()

template<class _TBackend>
PRecvStatus::PRecvStatus Daemon< _TBackend >::checkRecvStatus ( PRecvStatus::PRecvStatus recvStatus)
inherited

Check the status of recv sockets.

Parameters
recvStatus: status to be checked

Definition at line 75 of file Daemon_impl.h.

75 {
77// p_log.errorAndThrow<Phoenix::SocketStatusException>("Daemon::checkRecvStatus : Socket not available", "Socket not available");
78 p_log.getLogWarning() << "Daemon::checkRecvStatus : Socket not available" << std::endl;
79 }
81 p_log.criticalAndThrow<Phoenix::SocketStatusException>("Daemon::checkRecvStatus : Socket Backend caught a signal, aborting", "Socket Backend caught a signal, aborting");
82 }
84 p_log.criticalAndThrow<Phoenix::SocketStatusException>("Daemon::checkRecvStatus : Back-end is in invalid state", "Back-end is in invalid state");
85 }
87 p_log.criticalAndThrow<Phoenix::SocketStatusException>("Daemon::checkRecvStatus : Socket is in invalid state", "Socket is in invalid state");
88 }
90 p_log.errorAndThrow<Phoenix::SocketStatusException>("Daemon::checkRecvStatus : Cannot deserialize data", "Cannot deserialize data");
91 }
92 return recvStatus;
93}
Class which describes a Daemon with connections to other daemons.
Definition Daemon.h:17

References BaseDaemon::p_log.

Referenced by run().

+ Here is the caller graph for this function:

◆ checkSendStatus()

template<class _TBackend>
void Daemon< _TBackend >::checkSendStatus ( PSendStatus::PSendStatus sendStatus)
inherited

Check the status of recv sockets.

Parameters
sendStatus: status to be checked

Definition at line 100 of file Daemon_impl.h.

100 {
102 p_log.errorAndThrow<Phoenix::SocketStatusException>("Daemon::checkSendStatus : Socket not available", "Socket not available");
103 }
105 p_log.errorAndThrow<Phoenix::SocketStatusException>("Daemon::checkSendStatus : Receiver not reachable", "Receiver not reachable");
106 }
108 p_log.criticalAndThrow<Phoenix::SocketStatusException>("Daemon::checkSendStatus : Socket Backend caught a signal, aborting.", "Socket Backend caught a signal, aborting.");
109 }
111 p_log.criticalAndThrow<Phoenix::SocketStatusException>("Daemon::checkSendStatus : Back-end is in invalid state", "Back-end is in invalid state");
112 }
114 p_log.criticalAndThrow<Phoenix::SocketStatusException>("Daemon::checkSendStatus : Socket is in invalid state", "Socket is in invalid state");
115 }
117 p_log.errorAndThrow<Phoenix::SocketStatusException>("Daemon::checkSendStatus : Cannot serialize data", "Cannot serialize data");
118 }
119}

References BaseDaemon::p_log.

Referenced by sendMessage().

+ Here is the caller graph for this function:

◆ clearCallableMethod()

void BaseDaemon::clearCallableMethod ( )
inherited

Clear the map of callable methods.

Definition at line 131 of file BaseDaemon.cpp.

131 {
132 for(std::map<PString, AbstractFunction*>::iterator it(p_mapCallableMethod.begin()); it != p_mapCallableMethod.end(); ++it){
133 delete it->second;
134 }
135 p_mapCallableMethod.clear();
136}

References p_mapCallableMethod.

Referenced by ~BaseDaemon().

+ Here is the caller graph for this function:

◆ clearStat()

void BaseDaemon::clearStat ( )
inherited

Clear all the statistics of the daemon.

Definition at line 349 of file BaseDaemon.cpp.

349 {
350 for(MapStatAccumulator::iterator it = p_config.getDaemonStatAccumulator().getMapStatComputing().begin(); it != p_config.getDaemonStatAccumulator().getMapStatComputing().end(); ++it){
351 it->second.setNbEvent(0lu);
352 std::fill(it->second.getVecHistogram().begin(), it->second.getVecHistogram().end(), 0lu);
353 }
354 for(MapDaemonStatAccumulator::iterator itMap = p_config.getDaemonStatAccumulator().getMapStatCommunication().begin(); itMap != p_config.getDaemonStatAccumulator().getMapStatCommunication().end(); ++itMap){
355 for(MapStatAccumulator::iterator it = itMap->second.begin(); it != itMap->second.end(); ++it){
356 it->second.setNbEvent(0lu);
357 std::fill(it->second.getVecHistogram().begin(), it->second.getVecHistogram().end(), 0lu);
358 }
359 }
360}

References p_config.

Referenced by Daemon< _TBackend >::sendStatToStatDaemon().

+ Here is the caller graph for this function:

◆ createNewCommunicationStatMap()

std::map< PString, StatAccumulator > BaseDaemon::createNewCommunicationStatMap ( const PString & dataType,
size_t nbBin,
float histLowerBound,
float histUpperBound )
privateinherited

Create a new map of communication statistic.

Parameters
dataType: type of data which where pushed
nbBin: number of bin of the histogram
histLowerBound: lower bound of the histogram
histUpperBound: upper bound of the histogram
Returns
new map of communication statistic

Definition at line 411 of file BaseDaemon.cpp.

411 {
412 std::map<PString, StatAccumulator> newStatMap;
413 newStatMap[dataType] = createNewStat(nbBin, histLowerBound, histUpperBound);
414 return newStatMap;
415}

References createNewStat().

Referenced by getCommunicationStat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createNewStat()

StatAccumulator BaseDaemon::createNewStat ( size_t nbBin,
float histLowerBound,
float histUpperBound )
inherited

Create a new clear computing statistic.

Parameters
nbBin: number of bin of the histogram
histLowerBound: lower bound of the histogram
histUpperBound: upper bound of the histogram
Returns
new clear computing statistic

Definition at line 326 of file BaseDaemon.cpp.

326 {
327 StatAccumulator newStat;
328 newStat.setNbEvent(0lu);
329 newStat.setMin(std::nan(""));
330 newStat.setMax(std::nan(""));
331 newStat.setSum(std::nan(""));
332 newStat.setNbEventAboveUpperBound(0lu);
333 newStat.setNbEventBelowLowerBound(0lu);
334 newStat.setHistUpperBound(histUpperBound);
335 newStat.setHistLowerBound(histLowerBound);
336 newStat.setVecHistogram(std::vector<size_t>(nbBin, 0lu));
337 return newStat;
338}
void setMin(float min)
Sets the min of the StatAccumulator.
void setVecHistogram(const std::vector< size_t > &vecHistogram)
Sets the vecHistogram of the StatAccumulator.
void setHistUpperBound(float histUpperBound)
Sets the histUpperBound of the StatAccumulator.
void setMax(float max)
Sets the max of the StatAccumulator.
void setNbEventAboveUpperBound(size_t nbEventAboveUpperBound)
Sets the nbEventAboveUpperBound of the StatAccumulator.
void setHistLowerBound(float histLowerBound)
Sets the histLowerBound of the StatAccumulator.
void setNbEventBelowLowerBound(size_t nbEventBelowLowerBound)
Sets the nbEventBelowLowerBound of the StatAccumulator.
void setSum(float sum)
Sets the sum of the StatAccumulator.
void setNbEvent(size_t nbEvent)
Sets the nbEvent of the StatAccumulator.

References StatAccumulator::setHistLowerBound(), StatAccumulator::setHistUpperBound(), StatAccumulator::setMax(), StatAccumulator::setMin(), StatAccumulator::setNbEvent(), StatAccumulator::setNbEventAboveUpperBound(), StatAccumulator::setNbEventBelowLowerBound(), StatAccumulator::setSum(), and StatAccumulator::setVecHistogram().

Referenced by addDataCallableMethod(), addDataCallableMethod(), createNewCommunicationStatMap(), and getCommunicationStat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeOnStop()

template<class _TBackend>
void Daemon< _TBackend >::executeOnStop ( )
virtualinherited

Method which is called on stop of the Daemon.

Definition at line 206 of file Daemon_impl.h.

206{}

Referenced by run().

+ Here is the caller graph for this function:

◆ extraLoad()

bool BaseDaemon::extraLoad ( const ConfigNode * config)
virtualinherited

Extra call on load for the current Daemon.

Parameters
config: configuration for the current Daemon
Returns
true on success, false otherwise

Definition at line 102 of file BaseDaemon.cpp.

102 {
103 return true;
104}

◆ extraLoopProcessing()

template<class _TBackend>
void Daemon< _TBackend >::extraLoopProcessing ( )
virtualinherited

Computing Method for each event loop (when receiving message from other Daemon)

Definition at line 202 of file Daemon_impl.h.

202{}

Referenced by run().

+ Here is the caller graph for this function:

◆ fillDaemonStat()

void BaseDaemon::fillDaemonStat ( DaemonStat & stat,
time_t startTimestamp,
time_t endTimestamp )
protectedinherited

Fill the DaemonStat with the current statistics of the daemon.

Parameters
statDaemonStat to be filled
startTimestamptime at which the statistic started to be filled
endTimestamptime at which the statistic stopped to be filled

Definition at line 476 of file BaseDaemon.cpp.

476 {
477 // Fill the computing statistics
478 MapStatAccumulator & mapStatComputing = p_config.getDaemonStatAccumulator().getMapStatComputing();
479 for(MapStatAccumulator::iterator it = mapStatComputing.begin(); it != mapStatComputing.end(); ++it){
480 StatAccumulator & accumulator = it->second;
481 VecStat vecStat = fillVecStat(accumulator, startTimestamp, endTimestamp);
482 stat.getMapStatComputing()[it->first] = vecStat;
483 }
484
485 // Fill the communication statistics
486 MapDaemonStatAccumulator & mapStatCommunication = p_config.getDaemonStatAccumulator().getMapStatCommunication();
487 for(MapDaemonStatAccumulator::iterator itMap = mapStatCommunication.begin(); itMap != mapStatCommunication.end(); ++itMap){
488 const PString & destName = itMap->first;
489 std::map<PString, VecStat> & mapVecStat = stat.getMapStatCommunication()[destName];
490 for(MapStatAccumulator::iterator it = itMap->second.begin(); it != itMap->second.end(); ++it){
491 StatAccumulator & accumulator = it->second;
492 VecStat vecStat = fillVecStat(accumulator, startTimestamp, endTimestamp);
493 mapVecStat[it->first] = vecStat;
494 }
495 }
496}
std::map< PString, std::map< PString, StatAccumulator > > MapDaemonStatAccumulator
Definition BaseDaemon.h:38
std::map< PString, StatAccumulator > MapStatAccumulator
Definition BaseDaemon.h:39
VecStat fillVecStat(const StatAccumulator &accumulator, time_t startTimestamp, time_t endTimestamp)
Fill a VecStat from a StatAccumulator to send to the DamonStat.
const std::map< PString, VecStat > & getMapStatComputing() const
Gets the mapStatComputing of the DaemonStat.
const std::map< PString, std::map< PString, VecStat > > & getMapStatCommunication() const
Gets the mapStatCommunication of the DaemonStat.

References fillVecStat(), DaemonStat::getMapStatCommunication(), DaemonStat::getMapStatComputing(), and p_config.

Referenced by Daemon< _TBackend >::sendStatToStatDaemon().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillStatInfo()

template<class _TBackend>
PUncastableBool StatDaemonManager< _TBackend >::fillStatInfo ( const DaemonStat & stat)

Fill the StatInfo of the StatDaemonManager with the given DaemonStat.

Parameters
stat: DaemonStat to be filled
Returns
true on success, false otherwise

Definition at line 55 of file StatDaemonManager_impl.h.

55 {
56 p_mapDaemonStat[stat.getName()] = stat;
57 return UNCASTABLE_TRUE;
58}
MapDaemonStat p_mapDaemonStat
Statistics about all Daemon in the swarm.

References DaemonStat::getName(), and p_mapDaemonStat.

Referenced by sortFillDaemonStat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillVecStat()

VecStat BaseDaemon::fillVecStat ( const StatAccumulator & accumulator,
time_t startTimestamp,
time_t endTimestamp )
protectedinherited

Fill a VecStat from a StatAccumulator to send to the DamonStat.

Parameters
accumulatorStatAccumulator to be converted
startTimestamptime at which the statistic started to be filled
endTimestamptime at which the statistic stopped to be filled
Returns
VecStat filled with the statistics from the accumulator

Definition at line 446 of file BaseDaemon.cpp.

446 {
447 VecStat vecStat;
448
449 // Compute event values
450 vecStat.getNbEvent().push_back(accumulator.getNbEvent());
451 vecStat.getMin().push_back(accumulator.getMin());
452 vecStat.getMax().push_back(accumulator.getMax());
453 vecStat.getAverage().push_back(accumulator.getSum() / accumulator.getNbEvent());
454
455 // Compute time values
456 vecStat.getStartTimestamp().push_back(startTimestamp);
457 vecStat.getEndTimestamp().push_back(endTimestamp);
458 time_t rate = endTimestamp - startTimestamp;
459 vecStat.getRate().push_back(accumulator.getNbEvent()*1e9 / rate);
460 vecStat.getRateEventAboveUpperBound().push_back(accumulator.getNbEventAboveUpperBound()*1e9 / rate);
461 vecStat.getRateEventBelowLowerBound().push_back(accumulator.getNbEventBelowLowerBound()*1e9 / rate);
462
463 vecStat.getVecRateQuantile().resize(accumulator.getVecHistogram().size());
464 for(size_t i = 0; i < accumulator.getVecHistogram().size(); ++i){
465 vecStat.getVecRateQuantile()[i].push_back(accumulator.getVecHistogram()[i]*1e9 / rate);
466 }
467 return vecStat;
468}
float getSum() const
Gets the sum of the StatAccumulator.
size_t getNbEvent() const
Gets the nbEvent of the StatAccumulator.
float getMax() const
Gets the max of the StatAccumulator.
size_t getNbEventAboveUpperBound() const
Gets the nbEventAboveUpperBound of the StatAccumulator.
float getMin() const
Gets the min of the StatAccumulator.
size_t getNbEventBelowLowerBound() const
Gets the nbEventBelowLowerBound of the StatAccumulator.
const std::vector< size_t > & getVecHistogram() const
Gets the vecHistogram of the StatAccumulator.
const std::vector< float > & getMax() const
Gets the max of the VecStat.
const std::vector< time_t > & getEndTimestamp() const
Gets the endTimestamp of the VecStat.
const std::vector< float > & getRate() const
Gets the rate of the VecStat.
const std::vector< time_t > & getStartTimestamp() const
Gets the startTimestamp of the VecStat.
const std::vector< float > & getAverage() const
Gets the average of the VecStat.
const std::vector< float > & getRateEventBelowLowerBound() const
Gets the rateEventBelowLowerBound of the VecStat.
const std::vector< float > & getRateEventAboveUpperBound() const
Gets the rateEventAboveUpperBound of the VecStat.
const std::vector< float > & getMin() const
Gets the min of the VecStat.
const std::vector< size_t > & getNbEvent() const
Gets the nbEvent of the VecStat.
const std::vector< std::vector< float > > & getVecRateQuantile() const
Gets the vecRateQuantile of the VecStat.

References VecStat::getAverage(), VecStat::getEndTimestamp(), StatAccumulator::getMax(), VecStat::getMax(), StatAccumulator::getMin(), VecStat::getMin(), StatAccumulator::getNbEvent(), VecStat::getNbEvent(), StatAccumulator::getNbEventAboveUpperBound(), StatAccumulator::getNbEventBelowLowerBound(), VecStat::getRate(), VecStat::getRateEventAboveUpperBound(), VecStat::getRateEventBelowLowerBound(), VecStat::getStartTimestamp(), StatAccumulator::getSum(), StatAccumulator::getVecHistogram(), and VecStat::getVecRateQuantile().

Referenced by fillDaemonStat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCommunicationStat()

void BaseDaemon::getCommunicationStat ( const PString & destName,
const PString & dataType,
float latency,
size_t nbBin,
float histLowerBound,
float histUpperBound )
privateinherited

Add a communication statistic.

Parameters
destName: name of the destination Daemon from which data where pushed
dataType: type of data which where pushed
latency: latency between the send of the data and the receiving of the confirmation by the daemon destName
nbBin: number of bin of the histogram
histLowerBound: lower bound of the histogram
histUpperBound: upper bound of the histogram

Definition at line 425 of file BaseDaemon.cpp.

425 {
426 std::map<PString, std::map<PString, StatAccumulator> > & mapCommunication = p_config.getDaemonStatAccumulator().getMapStatCommunication();
427 MapDaemonStatAccumulator::iterator it = mapCommunication.find(destName);
428 if(it == mapCommunication.end()){
429 mapCommunication[destName] = createNewCommunicationStatMap(dataType, nbBin, histLowerBound, histUpperBound);
430 }
431 else{
432 std::map<PString, StatAccumulator>::iterator itDataType = it->second.find(dataType);
433 if(itDataType == it->second.end()){
434 it->second[dataType] = createNewStat(nbBin, histLowerBound, histUpperBound);
435 }
436 }
437 updateStatAccumulator(p_config.getDaemonStatAccumulator().getMapStatCommunication().find(destName)->second[dataType], latency);
438}
void updateStatAccumulator(StatAccumulator &stat, float value)
Update a computing statistic with a new value.
std::map< PString, StatAccumulator > createNewCommunicationStatMap(const PString &dataType, size_t nbBin, float histLowerBound, float histUpperBound)
Create a new map of communication statistic.

References createNewCommunicationStatMap(), createNewStat(), p_config, and updateStatAccumulator().

Referenced by processConfirmedMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getConfig()

DaemonConfig & BaseDaemon::getConfig ( )
inherited

Get the configuration of the current BaseDaemon.

Returns
configuration of the current BaseDaemon

Definition at line 365 of file BaseDaemon.cpp.

365 {
366 return p_config;
367}

References p_config.

Referenced by StatDaemonManager< _TBackend >::addCallMethod().

+ Here is the caller graph for this function:

◆ getDataFunction()

AbstractDataFunction * BaseDaemon::getDataFunction ( const Data & data)
inherited

Get the data function associated with the given data.

Parameters
dataThe data for which to retrieve the associated function
Returns
A pointer to the associated data function, or nullptr if not found

Definition at line 262 of file BaseDaemon.cpp.

262 {
263 PString prototype(data.getType());
264 std::map<PString, AbstractDataFunction*>::iterator it(p_mapDataFunction.find(prototype));
265 if(it == p_mapDataFunction.end()){
266 getLog().getLogError() << "BaseDaemon::getDataFunction : function to process data '"<<prototype<<"' not found" << std::endl;
267 return nullptr;
268 }
269 return it->second;
270}
const PString & getType() const
Gets the type of the Data.

References getLog(), Data::getType(), and p_mapDataFunction.

Referenced by processData(), and Daemon< _TBackend >::processInputMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLog()

◆ getLogger()

PLog & BaseDaemon::getLogger ( )
inherited

Get the logger of the current BaseDaemon.

Returns
logger of the current BaseDaemon

Definition at line 386 of file BaseDaemon.cpp.

386 {
387 return p_log;
388}

References p_log.

◆ getMainConfig()

DaemonMainConfig & BaseDaemon::getMainConfig ( )
inherited

Get the main configuration of the swarm.

Returns
main configuration of the swarm

Definition at line 379 of file BaseDaemon.cpp.

379 {
380 return p_mainConfig;
381}
DaemonMainConfig p_mainConfig
Main configuration of the Daemon.
Definition BaseDaemon.h:160

References p_mainConfig.

◆ getMapDaemonConfig()

MapDaemonConfig & BaseDaemon::getMapDaemonConfig ( )
inherited

Get the map of all Daemon configurations.

Returns
map of all Daemon configurations

Definition at line 372 of file BaseDaemon.cpp.

372 {
373 return p_mapDaemon;
374}
MapDaemonConfig p_mapDaemon
Map of the other Daemon of the Swarm.
Definition BaseDaemon.h:164

References p_mapDaemon.

◆ getMapDaemonStat()

template<class _TBackend>
const MapDaemonStat & StatDaemonManager< _TBackend >::getMapDaemonStat ( ) const

Get the map of DaemonStat.

Returns
map of DaemonStat

Definition at line 30 of file StatDaemonManager_impl.h.

30 {
31 return p_mapDaemonStat;
32}

References p_mapDaemonStat.

◆ getMapMessageToBeConfirmed()

const std::map< size_t, Message > & BaseDaemon::getMapMessageToBeConfirmed ( ) const
inherited

Get the map of message to be confirmed.

Returns
map of message to be confirmed

Definition at line 343 of file BaseDaemon.cpp.

343 {
345}

References p_mapMessageToBeConfirmed.

◆ getMessageId()

size_t BaseDaemon::getMessageId ( )
inherited

Get current message id.

Returns
current message id

Definition at line 253 of file BaseDaemon.cpp.

253 {
254 ++p_messageId;
255 return p_messageId;
256}
size_t p_messageId
Id counter of the message of the current Daemon.
Definition BaseDaemon.h:186

References p_messageId.

Referenced by Daemon< _TBackend >::sendData().

+ Here is the caller graph for this function:

◆ getMessageToConfirm()

bool BaseDaemon::getMessageToConfirm ( Message & message,
size_t id ) const
inherited

Get a message to confirm by id if it exists.

Parameters
[out]message: message which has the id id
id: id of the message to be searched
Returns
true if the message with id id does exist, false otherwise

Definition at line 189 of file BaseDaemon.cpp.

189 {
190 std::map<size_t, Message>::const_iterator it(p_mapMessageToBeConfirmed.find(id));
191 if(it != p_mapMessageToBeConfirmed.end()){
192 message = it->second;
193 return true;
194 }
195 return false;
196}

References p_mapMessageToBeConfirmed.

◆ getOptionParser()

OptionParser & BaseDaemon::getOptionParser ( )
inherited

Return the OptionParser of the current BaseDaemon.

Returns
OptionParser of the current BaseDaemon

Definition at line 147 of file BaseDaemon.cpp.

147 {
148 return p_optionParser;
149}
OptionParser p_optionParser
Option parser of the Daemon.
Definition BaseDaemon.h:180

References p_optionParser.

◆ getStatsCount()

template<class _TBackend>
size_t StatDaemonManager< _TBackend >::getStatsCount ( ) const

Get the count of stats received.

Returns
number of stats received

Definition at line 46 of file StatDaemonManager_impl.h.

46 {
47 return p_mapDaemonStat.size();
48}

References p_mapDaemonStat.

◆ hasReceivedStats()

template<class _TBackend>
bool StatDaemonManager< _TBackend >::hasReceivedStats ( ) const

Check if stats have been received.

Returns
true if the stats have been received, false otherwise

Definition at line 38 of file StatDaemonManager_impl.h.

38 {
39 return !p_mapDaemonStat.empty();
40}

References p_mapDaemonStat.

◆ initialisationBaseDaemon()

void BaseDaemon::initialisationBaseDaemon ( )
privateinherited

Initialisation function of the class BaseDaemon.

Definition at line 391 of file BaseDaemon.cpp.

391 {
392 p_optionParser.setExampleLongOption("phoenix_daemon --daemonconfig=daemon_config.toml --daemonname=main");
393 p_optionParser.setExampleShortOption("phoenix_daemon -c daemon_config.toml -n main");
394 p_optionParser.addOption("daemonconfig", "c", OptionType::FILENAME, true, "Toml configuration file which define all Daemons of the swarm");
395 p_optionParser.addOption("daemonname", "n", OptionType::STRING, true, "Name of the current Daemon of the swarm configuration defined with --daemonconfig");
396 p_optionParser.addOption("mock", "m", OptionType::NONE, false, "Activate the Daemon in mock mode for the sockets and the clock");
397 p_optionParser.addOption("mockrecord", "r", OptionType::NONE, false, "Activate the Daemon in mock record mode for the sockets and the clock");
398 p_isRun = false;
399 p_messageId = 0lu;
400 p_isFullMock = false;
401 p_isFullMockRecord = false;
402}
bool p_isRun
True if the current BaseDaemon is running.
Definition BaseDaemon.h:168
bool p_isFullMockRecord
True if the daemon has to be executed in mock record mode for socket and clock.
Definition BaseDaemon.h:172
bool p_isFullMock
True if the daemon has to be executed in mock mode for socket and clock.
Definition BaseDaemon.h:170

References p_isFullMock, p_isFullMockRecord, p_isRun, p_messageId, and p_optionParser.

Referenced by BaseDaemon().

+ Here is the caller graph for this function:

◆ initialisationDaemon()

template<class _TBackend>
void Daemon< _TBackend >::initialisationDaemon ( )
privateinherited

Initialisation function of the class Daemon.

Definition at line 210 of file Daemon_impl.h.

210 {
211
212}

Referenced by Daemon().

+ Here is the caller graph for this function:

◆ initialisationDaemonSocket()

template<class _TBackend>
void Daemon< _TBackend >::initialisationDaemonSocket ( )
privateinherited

Initialise the Daemon Sockets.

Definition at line 216 of file Daemon_impl.h.

216 {
217 if(p_config.getName() == ""){
218 getLog().criticalAndThrow<Phoenix::ConfigException>("Daemon::initialisationDaemonSocket", "daemon has no name");
219 }
223 }else{
224 if(p_isFullMock){
227 }
228 }
229 //Let's send when we are a client and recv when we are a server
230 //By doing this way, we have one server per Daemon and as many clients as other Daemon
231 getLog().getLogInfo() << "Daemon<_TBackend>::initialisationDaemonSocket() : initialise pull socket for daemon '" << p_config.getName() << "'" << std::endl;
232 phoenix_assert(p_backend.socketManager.addServerSocket("pull",
233 PSocketParam{p_config.getHostName(), p_config.getReceivingPort(), p_mainConfig.recvTimeoutMs, p_mainConfig.sendTimeoutMs}, p_backend.extraServerParam,
234 "./" + p_config.getName() + "_", p_backend.extraMockServerParam));
235
236 //Now let's initialise connexions to other
237 for(MapDaemonConfig::iterator it(p_mapDaemon.begin()); it != p_mapDaemon.end(); ++it){
238 if(it->second.getName() == p_config.getName()){continue;}
239 getLog().getLogInfo() << "Daemon<_TBackend>::initialisationDaemonSocket() : initialise send socket for neighbour Daemon '"<<it->second.getName()<<"'" << std::endl;
240 phoenix_assert(p_backend.socketManager.addClientSocket(it->second.getName(),
241 PSocketParam{it->second.getHostName(), it->second.getReceivingPort(), p_mainConfig.recvTimeoutMs, p_mainConfig.sendTimeoutMs}, p_backend.extraClientParam,
242 "./" + p_config.getName() + "_", p_backend.extraMockClientParam));
243 // p_backend.socketManager.getSocket(it->second.getName())->waitUntilConnection(500000lu, 30lu); //0.5 s per check and 30 checks
244 }
245 getLog().getLogInfo() << "Daemon<_TBackend>::initialisationDaemonSocket() : all connection to neighbours Daemon initialised" << std::endl;
246 p_backend.clock.setMockPrefix("./" + p_config.getName() + "_");
247}
_TBackend p_backend
Full backend of the Daemon (for Socket and clock)
Definition Daemon.h:49
void setSocketMode(PSocketMode::PSocketMode mode)
Set the mode of the sockets of the SocketManager.
Definition Daemon_impl.h:31
void setClockMode(PClockMode::PClockMode mode)
Set the mode of the clock.
Definition Daemon_impl.h:53

References BaseDaemon::getLog(), p_backend, BaseDaemon::p_config, BaseDaemon::p_isFullMock, BaseDaemon::p_isFullMockRecord, BaseDaemon::p_mapDaemon, setClockMode(), and setSocketMode().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initializeStatDaemonManager()

template<class _TBackend>
void StatDaemonManager< _TBackend >::initializeStatDaemonManager ( )
private

Initialize the StatDaemonManager.

Definition at line 62 of file StatDaemonManager_impl.h.

62 {
63
64}

Referenced by StatDaemonManager().

+ Here is the caller graph for this function:

◆ isDaemonExist()

bool BaseDaemon::isDaemonExist ( const PString & name) const
inherited

Say if a neighbour Daemon does exist.

Parameters
name: name of the Daemon to be searched
Returns
true if the Daemon does exist, false otherwise

Definition at line 162 of file BaseDaemon.cpp.

162 {
163 MapDaemonConfig::const_iterator it(p_mapDaemon.find(name));
164 if(it == p_mapDaemon.end()){
165 //Then if the stat daemon does not exist in the map, it may be the current daemon
166 if(p_config.getName() == name){
167 return true;
168 }
169 }
170 if(it != p_mapDaemon.end()){
171 return true;
172 }
173
174 return false;
175}

References p_config, and p_mapDaemon.

Referenced by loadConfigFromNode().

+ Here is the caller graph for this function:

◆ load() [1/2]

bool BaseDaemon::load ( const PPath & fileName,
const PString & daemonName )
inherited

Load the Toml configuration which define all BaseDaemons of the Swarm.

Parameters
fileName: name of the configuration file of all the BaseDaemons of the Swarm in toml format
daemonName: name of the current BaseDaemon in the given file
Returns
true on success, false otherwise

Definition at line 91 of file BaseDaemon.cpp.

91 {
92 ConfigNode dico;
93 daemon_load_config(p_log, dico, fileName);
94 loadConfigFromNode(dico, daemonName);
95 return true;
96}
void loadConfigFromNode(const ConfigNode &dico, const PString &daemonName)
Load configuration form a node of ConfigNode.
void daemon_load_config(PLog &log, ConfigNode &dico, const PString &inputConfig, ConfigFormat::ConfigFormat format)
Load the daemon config into a ConfigNode from a json string.

References daemon_load_config(), loadConfigFromNode(), and p_log.

+ Here is the call graph for this function:

◆ load() [2/2]

bool BaseDaemon::load ( const PString & configFileContent,
const PString & daemonName,
ConfigFormat::ConfigFormat format )
inherited

Load the Json configuration which define all BaseDaemons of the Swarm.

Parameters
configFileContent: name of the configuration file of all the BaseDaemons of the Swarm in json format
daemonName: name of the current BaseDaemon in the given file
format: format of the configuration file
Returns
true on success, false otherwise

Definition at line 79 of file BaseDaemon.cpp.

79 {
80 ConfigNode dico;
81 daemon_load_config(p_log, dico, configFileContent, format);
82 loadConfigFromNode(dico, daemonName);
83 return true;
84}

References daemon_load_config(), loadConfigFromNode(), and p_log.

Referenced by parseArgument().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadConfigFromNode()

void BaseDaemon::loadConfigFromNode ( const ConfigNode & dico,
const PString & daemonName )
inherited

Load configuration form a node of ConfigNode.

Parameters
[out]dico: loaded configuration
daemonName: name of the current Daemon in the configuration
Returns
true on success, false otherwise

Definition at line 45 of file BaseDaemon.cpp.

45 {
46 const ConfigNode * mapMainConfig = dico.getChild("swarm");
47 if(mapMainConfig != nullptr){
48 p_mainConfig.recvTimeoutMs = phoenix_get_value<int>(*mapMainConfig, "recv_timeout_ms", -1);
49 p_mainConfig.sendTimeoutMs = phoenix_get_value<int>(*mapMainConfig, "send_timeout_ms", -1);
50 p_mainConfig.recvFlag = daemonRecvFlagFromString(phoenix_get_string(*mapMainConfig, "recv_flag", "NON_BLOCK"));
51 p_mainConfig.sendFlag = daemonSendFlagFromString(phoenix_get_string(*mapMainConfig, "send_flag", "NON_BLOCK"));
52 }
53 std::map<PString, time_t> mapTimeout;
54 const ConfigNode * extraConfigParam = nullptr;
55 daemon_read_configNode(p_config, p_mapDaemon, p_log, mapTimeout, extraConfigParam, dico, daemonName);
56
57 const ConfigNode * mapStatDaemon = dico.getChild("statistics");
58 if(mapStatDaemon != nullptr){
59 p_config.setStatDaemonName(daemon_loadString(*mapStatDaemon, "stat_daemon_name"));
60 }
61 p_config.setMapTimeout(mapTimeout);
62 if(p_config.getStatDaemonName() != ""){
63 if(!isDaemonExist(p_config.getStatDaemonName())){
64 p_log.getLogError() << "BaseDaemon::loadConfigFromNode : stat daemon '"<<p_config.getStatDaemonName()<<"' not found in configuration" << std::endl;
65 }
66 }
67
68 p_log.getLogInfo() << "BaseDaemon::loadConfigFromNode : loading configuration successful" << std::endl;
69 p_log.getLogInfo() << "BaseDaemon::loadConfigFromNode : ready to call addCallMethod to subscribe on received data" << std::endl;
71}
bool isDaemonExist(const PString &name) const
Say if a neighbour Daemon does exist.
virtual void addCallMethod()
Do the addCallableMethod here.
PString daemon_loadString(const ConfigNode &dico, const PString &attributeName)
Load a string value.
void daemon_read_configNode(DaemonConfig &daemonConfig, MapDaemonConfig &mapDaemon, PLog &log, MapTimeout &mapTimeout, const ConfigNode *&extraConfigParam, const ConfigNode &dico, const PString &daemonName)
Read the ConfigNode to initialise current Daemon.

References addCallMethod(), daemon_loadString(), daemon_read_configNode(), isDaemonExist(), p_config, p_log, p_mainConfig, and p_mapDaemon.

Referenced by load(), and load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseArgument()

bool BaseDaemon::parseArgument ( int argc,
char ** argv )
inherited

Parse arguments given to the BaseDaemon with command line.

Parameters
argc: number of arguments given to the program
argv: list of arguments given to the program
Returns
true on success, false otherwise

Definition at line 28 of file BaseDaemon.cpp.

28 {
29 p_optionParser.parseArgument(argc, argv);
30 const OptionMode & defaultMode = p_optionParser.getDefaultMode();
31 PPath configurationFile;
32 defaultMode.getValue(configurationFile, "daemonconfig");
33 PString daemonName;
34 defaultMode.getValue(daemonName, "daemonname");
35 p_isFullMock = defaultMode.isOptionExist("mock");
36 p_isFullMockRecord = defaultMode.isOptionExist("mockrecord");
37 return load(configurationFile, daemonName);
38}
bool load(const PString &configFileContent, const PString &daemonName, ConfigFormat::ConfigFormat format)
Load the Json configuration which define all BaseDaemons of the Swarm.

References load(), p_isFullMock, p_isFullMockRecord, and p_optionParser.

+ Here is the call graph for this function:

◆ processConfirmedMessage()

void BaseDaemon::processConfirmedMessage ( size_t id,
time_t currentTime )
inherited

Process confirmed message.

Parameters
id: id of the message to be removed
currentTime: time when the confirmation was received

Definition at line 202 of file BaseDaemon.cpp.

202 {
203 std::map<size_t, Message>::const_iterator it(p_mapMessageToBeConfirmed.find(id));
204 if(it != p_mapMessageToBeConfirmed.end()){
205 getLog().getLogInfo() << "BaseDaemon::processConfirmedMessage : adding statistics for processed transaction " << id << std::endl;
206 const Message & message = it->second;
207 time_t ellapsedTime = currentTime - message.getSendTime();
208 for(const PString & receiver : message.getVecRecver()){
209 getLog().getLogDebug() << "BaseDaemon::processConfirmedMessage : add statistic for receiver : " << receiver << std::endl;
210 getCommunicationStat(receiver, message.getData().getType(), ellapsedTime, p_config.getStatNbBin(), p_config.getStatHistLowerBound(), p_config.getStatHistUpperBound());
211 }
212 // Remove the confirmed message
213 getLog().getLogInfo() << "BaseDaemon::removeConfirmedMessage : remove confirmed transaction " << id << std::endl;
215 }else{
216 getLog().getLogError() << "BaseDaemon::processConfirmedMessage : transaction " << id << " not found in p_mapMessageToBeConfirmed" << std::endl;
217 }
218}
void getCommunicationStat(const PString &destName, const PString &dataType, float latency, size_t nbBin, float histLowerBound, float histUpperBound)
Add a communication statistic.
const Data & getData() const
Gets the data of the Message.

References getCommunicationStat(), Message::getData(), getLog(), Message::getSendTime(), Data::getType(), Message::getVecRecver(), p_config, and p_mapMessageToBeConfirmed.

Referenced by Daemon< _TBackend >::processInputMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processData()

bool BaseDaemon::processData ( const Data & data)
inherited

Process given data with the proper method.

Parameters
data: data to be processed
Returns
true on success, false otherwise

Definition at line 276 of file BaseDaemon.cpp.

276 {
277 AbstractDataFunction* function = getDataFunction(data);
278 if(function == nullptr){
279 return false;
280 }
281 getLog().getLogDebug() << "BaseDaemon::processData : process data '"<<data.getType()<<"'" << std::endl;
282 bool b = function->call(p_log, data);
283 return b;
284}
virtual bool call(PLog &log, const Data &data)=0
AbstractDataFunction * getDataFunction(const Data &data)
Get the data function associated with the given data.

References AbstractDataFunction::call(), getDataFunction(), getLog(), Data::getType(), and p_log.

+ Here is the call graph for this function:

◆ processEvent()

template<class _TBackend>
bool StatDaemonManager< _TBackend >::processEvent ( )

Process event.

Returns
true

Definition at line 70 of file StatDaemonManager_impl.h.

70 {
71 // bool bResult = Daemon<_TBackend>::sendValue("SwarmTop", p_mapDaemonStat);
72 return true;
73}

◆ processInputMessage()

template<class _TBackend>
void Daemon< _TBackend >::processInputMessage ( Message & message)
protectedinherited

Process an input message.

Parameters
[out]message: received Message to be processed

Definition at line 253 of file Daemon_impl.h.

253 {
254 //Check is the message needs a confirmation
255 if(message.getIsConfirmationNeeded()){
257 //We do not need to change the time of the message because it has to be in the clock reference of the sender
258 confirmation.setSendTime(message.getSendTime());
259 confirmation.setId(message.getId());
260 confirmation.setSender(p_config.getName());
262 confirmation.getVecRecver().push_back(message.getSender());
264 }
265
266 //Let's check is we receive a stop message
267 if(message.getType() == MessageType::STOP){stop();}
268 else if(message.getType() == MessageType::MESSAGE_CONFIRMATION){
269 processConfirmedMessage(message.getId(), p_backend.clock.now());
270 }else if(message.getType() == MessageType::RESULT_DATA){
272 if(function == NULL){
273 return;
274 }
275 time_t functionStartTime = p_backend.clock.now();
276 if(!function->call(p_log, message.getData())){
277 getLog().getLogError() << "Daemon<_TBackend>::processInputMessage : cannot process data of type '"<<message.getData().getType()<<"' from Daemon '"<<message.getSender()<<"'" << std::endl;
278 return;
279 }
281 getLog().getLogDebug() << "Daemon<_TBackend>::processInputMessage : function '"<<message.getData().getType()<<"' processed data from daemon '"<<message.getSender()<<"' in "<<functionEllapsedTime<<" nanoseconds" << std::endl;
282 if(p_config.getStatDaemonName() != "" && p_config.getStatDaemonName() != p_config.getName()){
283 updateStatAccumulator(p_config.getDaemonStatAccumulator().getMapStatComputing().find(message.getData().getType())->second, functionEllapsedTime);
284 }
285 }
286}
void stop()
Stops the BaseDaemon.
void processConfirmedMessage(size_t id, time_t currentTime)
Process confirmed message.
bool sendMessage(const Message &message)
Send message to other Daemon.

References AbstractDataFunction::call(), Message::getData(), BaseDaemon::getDataFunction(), Message::getId(), Message::getIsConfirmationNeeded(), BaseDaemon::getLog(), Message::getSender(), Message::getSendTime(), Data::getType(), Message::getType(), Message::getVecRecver(), MessageType::MESSAGE_CONFIRMATION, p_backend, BaseDaemon::p_config, BaseDaemon::p_log, BaseDaemon::processConfirmedMessage(), MessageType::RESULT_DATA, sendMessage(), Message::setId(), Message::setSender(), Message::setSendTime(), Message::setType(), MessageType::STOP, BaseDaemon::stop(), and BaseDaemon::updateStatAccumulator().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run()

template<class _TBackend>
bool Daemon< _TBackend >::run ( )
inherited

Run the Daemon.

Returns
true if the run was a success, false otherwise

Definition at line 125 of file Daemon_impl.h.

125 {
126 p_isRun = true;
127 //Let's initialise all connexions
129 p_startTimestamp = p_backend.clock.now();
130 p_statTimer.setEllapsedTime(p_config.getStatTimerPeriodMs());
131 p_statTimer.setStartTime(p_startTimestamp);
132 while(p_isRun){
133 //Let's get the last received message
134 //If there is not message, we treat the rest of the loop
136 PRecvStatus::PRecvStatus recvStatus = checkRecvStatus(p_backend.socketManager.recvData("pull", message, p_mainConfig.recvFlag));
139 }
141
142 time_t currentTime = p_backend.clock.now();
144 if(p_statTimer.isTime(currentTime) || !p_isRun){
146 }
147 }
148 //Let's execute a last command before stop
150 return true;
151}
void checkMessageTimeout(time_t currentTime)
Check if a message has reached the timeout.
PTimer p_statTimer
Timer to send statistics to the Stat Daemon.
Definition Daemon.h:51
virtual void executeOnStop()
Method which is called on stop of the Daemon.
void sendStatToStatDaemon(time_t currentTime)
Send the statistics of the Daemon to the Stat Daemon.
PRecvStatus::PRecvStatus checkRecvStatus(PRecvStatus::PRecvStatus recvStatus)
Check the status of recv sockets.
Definition Daemon_impl.h:75
time_t p_startTimestamp
Start timestamp of the current accumulation of statistics.
Definition Daemon.h:53
void processInputMessage(Message &message)
Process an input message.
virtual void extraLoopProcessing()
Computing Method for each event loop (when receiving message from other Daemon)
void initialisationDaemonSocket()
Initialise the Daemon Sockets.

References BaseDaemon::checkMessageTimeout(), checkRecvStatus(), executeOnStop(), extraLoopProcessing(), initialisationDaemonSocket(), p_backend, BaseDaemon::p_config, BaseDaemon::p_isRun, BaseDaemon::p_mainConfig, p_startTimestamp, p_statTimer, processInputMessage(), and sendStatToStatDaemon().

+ Here is the call graph for this function:

◆ sendData()

template<class _TBackend>
bool Daemon< _TBackend >::sendData ( const PString & destinationName,
const Data & data,
bool isConfirmationNeeded )
inherited

Send data to other Daemon (specialization for Data)

Parameters
destinationName: name of the destination Daemon of the data
data: data to be sent
isConfirmationNeeded: true if a confirmation is needed
Returns
true on success, false otherwise (maybe received method does not exist)

Definition at line 188 of file Daemon_impl.h.

188 {
190 message.setSendTime(p_backend.clock.now());
191 message.setData(data);
192 message.setId(getMessageId());
193 message.setIsConfirmationNeeded(isConfirmationNeeded);
195 message.setSender(p_config.getName());
196 message.getVecRecver().push_back(destinationName);
198}
size_t getMessageId()
Get current message id.

References BaseDaemon::getMessageId(), Message::getVecRecver(), p_backend, BaseDaemon::p_config, MessageType::RESULT_DATA, sendMessage(), Message::setData(), Message::setId(), Message::setIsConfirmationNeeded(), Message::setSender(), Message::setSendTime(), and Message::setType().

Referenced by sendValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendMessage() [1/2]

template<class _TBackend>
bool Daemon< _TBackend >::sendMessage ( const Message & message)
inherited

Send message to other Daemon.

Parameters
message: message to be sent
Returns
true on success, false otherwise (maybe received method does not exist)

Definition at line 158 of file Daemon_impl.h.

158 {
159 bool b(true);
160 const PVecString & vecDestination = message.getVecRecver();
162 b &= sendMessage(*it, message);
163 }
164 return b;
165}

References Message::getVecRecver(), and sendMessage().

Referenced by processInputMessage(), sendData(), and sendMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendMessage() [2/2]

template<class _TBackend>
bool Daemon< _TBackend >::sendMessage ( const PString & destinationName,
const Message & message )
inherited

Send message to other Daemon.

Parameters
destinationName: name of the destination Daemon of the message
message: message to be sent
Returns
true on success, false otherwise (maybe received method does not exist)

Definition at line 173 of file Daemon_impl.h.

173 {
174 if(message.getIsConfirmationNeeded()){
176 }
177 checkSendStatus(p_backend.socketManager.sendData(destinationName, message, p_mainConfig.sendFlag));
178 return true;
179}
void addMessageToConfirm(const Message &message)
Add a message to confirm.
void checkSendStatus(PSendStatus::PSendStatus sendStatus)
Check the status of recv sockets.

References BaseDaemon::addMessageToConfirm(), checkSendStatus(), Message::getIsConfirmationNeeded(), p_backend, and BaseDaemon::p_mainConfig.

+ Here is the call graph for this function:

◆ sendStatToStatDaemon()

template<class _TBackend>
void Daemon< _TBackend >::sendStatToStatDaemon ( time_t currentTime)
privateinherited

Send the statistics of the Daemon to the Stat Daemon.

Parameters
[out]currentTime: current time to be used for the statistics

Definition at line 292 of file Daemon_impl.h.

292 {
293 //Let's fill the DaemonStat
296 stat.setName(p_config.getName());
297
298 //Let's send it to the Stat Daemon
299 if(p_config.getStatDaemonName() != "" && p_config.getStatDaemonName() != p_config.getName()){
300 getLog().getLogDebug() << "Daemon::sendStatToStatDaemon() : sending statistics to Stat Daemon '"<<p_config.getStatDaemonName()<<"'" << std::endl;
301 sendValue(p_config.getStatDaemonName(), stat, true);
302 }
303
304 clearStat();
306}
void fillDaemonStat(DaemonStat &stat, time_t startTimestamp, time_t endTimestamp)
Fill the DaemonStat with the current statistics of the daemon.
void clearStat()
Clear all the statistics of the daemon.
bool sendValue(const PString &destinationName, const T &data, bool isConfirmationNeeded=true)
Send data to other Daemon.
Definition Daemon.h:38

References BaseDaemon::clearStat(), BaseDaemon::fillDaemonStat(), BaseDaemon::getLog(), BaseDaemon::p_config, p_startTimestamp, sendValue(), and DaemonStat::setName().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendValue()

template<class _TBackend>
template<typename T>
bool Daemon< _TBackend >::sendValue ( const PString & destinationName,
const T & data,
bool isConfirmationNeeded = true )
inlineinherited

Send data to other Daemon.

Parameters
destinationName: name of the destination Daemon of the data
data: data to be sent
isConfirmationNeeded: true if a confirmation is needed
Returns
true on success, false otherwise (maybe received method does not exist)

Definition at line 38 of file Daemon.h.

38 {
40 }
bool sendData(const PString &destinationName, const Data &data, bool isConfirmationNeeded)
Send data to other Daemon (specialization for Data)
Data phoenix_createData(const T &value)
Create a Data from a value.

References phoenix_createData(), and sendData().

Referenced by sendStatToStatDaemon().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setClockMode()

template<class _TBackend>
void Daemon< _TBackend >::setClockMode ( PClockMode::PClockMode mode)
inherited

Set the mode of the clock.

Parameters
mode: mode of the clock (NO_MOCK, MOCK, MOCK_RECORD)

Definition at line 53 of file Daemon_impl.h.

53 {
54 p_backend.clock.setMode(mode);
55 switch(mode){
57 p_isFullMock = true;
58 p_isFullMockRecord = false;
59 break;
61 p_isFullMock = false;
62 p_isFullMockRecord = true;
63 break;
64 default:
65 p_isFullMock = false;
66 p_isFullMockRecord = false;
67 break;
68 }
69}

References p_backend, BaseDaemon::p_isFullMock, and BaseDaemon::p_isFullMockRecord.

Referenced by initialisationDaemonSocket().

+ Here is the caller graph for this function:

◆ setSocketMode()

template<class _TBackend>
void Daemon< _TBackend >::setSocketMode ( PSocketMode::PSocketMode mode)
inherited

Set the mode of the sockets of the SocketManager.

Parameters
mode: mode of the socket manager (NO_MOCK, MOCK, MOCK_RECORD)

Definition at line 31 of file Daemon_impl.h.

31 {
32 p_backend.socketManager.setMode(mode);
33 switch(mode){
35 p_isFullMock = true;
36 p_isFullMockRecord = false;
37 break;
39 p_isFullMock = false;
40 p_isFullMockRecord = true;
41 break;
42 default:
43 p_isFullMock = false;
44 p_isFullMockRecord = false;
45 break;
46 }
47}

References p_backend, BaseDaemon::p_isFullMock, and BaseDaemon::p_isFullMockRecord.

Referenced by initialisationDaemonSocket().

+ Here is the caller graph for this function:

◆ stop()

void BaseDaemon::stop ( )
inherited

Stops the BaseDaemon.

Definition at line 139 of file BaseDaemon.cpp.

139 {
140 p_log.getLogInfo() << "Stopping Daemon '"<<p_config.getName()<<"' at '"<<p_config.getHostName()<<"'" << std::endl;
141 p_isRun = false;
142}

References p_config, p_isRun, and p_log.

Referenced by Daemon< _TBackend >::processInputMessage().

+ Here is the caller graph for this function:

◆ updateStatAccumulator()

void BaseDaemon::updateStatAccumulator ( StatAccumulator & stat,
float value )
inherited

Update a computing statistic with a new value.

Parameters
stat: statistic to be updated
value: new value to be added to the statistic

Definition at line 290 of file BaseDaemon.cpp.

290 {
291 stat.setNbEvent(stat.getNbEvent() + 1lu);
292 getLog().getLogDebug() << "BaseDaemon::updateStatAccumulator : event nb is " << stat.getNbEvent() << std::endl;
293 if(stat.getNbEvent() == 1lu){
294 stat.setMin(value);
295 stat.setMax(value);
296 stat.setSum(value);
297 }else{
298 if(value < stat.getMin()){
299 stat.setMin(value);
300 }
301 if(value > stat.getMax()){
302 stat.setMax(value);
303 }
304 stat.setSum(stat.getSum() + value);
305 }
306 if(value > stat.getHistUpperBound()){
308 }
309 if(value < stat.getHistLowerBound()){
311 }
312 float binSize = (stat.getHistUpperBound() - stat.getHistLowerBound()) / stat.getVecHistogram().size();
313 size_t bin = (value - stat.getHistLowerBound()) / binSize;
314 if(bin < stat.getVecHistogram().size()){
315 std::vector<size_t> & vecHistogram = stat.getVecHistogram();
316 vecHistogram[bin] = vecHistogram[bin] + 1lu;
317 }
318}
float getHistUpperBound() const
Gets the histUpperBound of the StatAccumulator.
float getHistLowerBound() const
Gets the histLowerBound of the StatAccumulator.

References StatAccumulator::getHistLowerBound(), StatAccumulator::getHistUpperBound(), getLog(), StatAccumulator::getMax(), StatAccumulator::getMin(), StatAccumulator::getNbEvent(), StatAccumulator::getNbEventAboveUpperBound(), StatAccumulator::getNbEventBelowLowerBound(), StatAccumulator::getSum(), StatAccumulator::getVecHistogram(), StatAccumulator::setMax(), StatAccumulator::setMin(), StatAccumulator::setNbEvent(), StatAccumulator::setNbEventAboveUpperBound(), StatAccumulator::setNbEventBelowLowerBound(), and StatAccumulator::setSum().

Referenced by getCommunicationStat(), and Daemon< _TBackend >::processInputMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ p_backend

template<class _TBackend>
_TBackend Daemon< _TBackend >::p_backend
protectedinherited

Full backend of the Daemon (for Socket and clock)

Definition at line 49 of file Daemon.h.

Referenced by initialisationDaemonSocket(), processInputMessage(), run(), sendData(), sendMessage(), setClockMode(), and setSocketMode().

◆ p_config

◆ p_isFullMock

bool BaseDaemon::p_isFullMock
protectedinherited

True if the daemon has to be executed in mock mode for socket and clock.

Definition at line 170 of file BaseDaemon.h.

Referenced by initialisationBaseDaemon(), Daemon< _TBackend >::initialisationDaemonSocket(), parseArgument(), Daemon< _TBackend >::setClockMode(), and Daemon< _TBackend >::setSocketMode().

◆ p_isFullMockRecord

bool BaseDaemon::p_isFullMockRecord
protectedinherited

True if the daemon has to be executed in mock record mode for socket and clock.

Definition at line 172 of file BaseDaemon.h.

Referenced by initialisationBaseDaemon(), Daemon< _TBackend >::initialisationDaemonSocket(), parseArgument(), Daemon< _TBackend >::setClockMode(), and Daemon< _TBackend >::setSocketMode().

◆ p_isRun

bool BaseDaemon::p_isRun
protectedinherited

True if the current BaseDaemon is running.

Definition at line 168 of file BaseDaemon.h.

Referenced by initialisationBaseDaemon(), Daemon< _TBackend >::run(), and stop().

◆ p_log

◆ p_mainConfig

DaemonMainConfig BaseDaemon::p_mainConfig
protectedinherited

Main configuration of the Daemon.

Definition at line 160 of file BaseDaemon.h.

Referenced by getMainConfig(), loadConfigFromNode(), Daemon< _TBackend >::run(), and Daemon< _TBackend >::sendMessage().

◆ p_mapCallableMethod

std::map<PString, AbstractFunction*> BaseDaemon::p_mapCallableMethod
privateinherited

Map of callable method of the Daemon.

Definition at line 182 of file BaseDaemon.h.

Referenced by addCallableMethod(), callMethod(), and clearCallableMethod().

◆ p_mapDaemon

MapDaemonConfig BaseDaemon::p_mapDaemon
protectedinherited

Map of the other Daemon of the Swarm.

Definition at line 164 of file BaseDaemon.h.

Referenced by getMapDaemonConfig(), Daemon< _TBackend >::initialisationDaemonSocket(), isDaemonExist(), and loadConfigFromNode().

◆ p_mapDaemonStat

template<class _TBackend>
MapDaemonStat StatDaemonManager< _TBackend >::p_mapDaemonStat
private

Statistics about all Daemon in the swarm.

Definition at line 32 of file StatDaemonManager.h.

Referenced by fillStatInfo(), getMapDaemonStat(), getStatsCount(), and hasReceivedStats().

◆ p_mapDataFunction

std::map<PString, AbstractDataFunction*> BaseDaemon::p_mapDataFunction
privateinherited

Map of methods which have to be called when receiving data.

Definition at line 189 of file BaseDaemon.h.

Referenced by addDataCallableMethod(), addDataCallableMethod(), and getDataFunction().

◆ p_mapMessageToBeConfirmed

std::map<size_t, Message> BaseDaemon::p_mapMessageToBeConfirmed
privateinherited

Map of messages which have to be confirmed by destination Daemon.

Definition at line 184 of file BaseDaemon.h.

Referenced by addMessageToConfirm(), checkMessageTimeout(), getMapMessageToBeConfirmed(), getMessageToConfirm(), and processConfirmedMessage().

◆ p_messageId

size_t BaseDaemon::p_messageId
privateinherited

Id counter of the message of the current Daemon.

Definition at line 186 of file BaseDaemon.h.

Referenced by getMessageId(), and initialisationBaseDaemon().

◆ p_optionParser

OptionParser BaseDaemon::p_optionParser
privateinherited

Option parser of the Daemon.

Definition at line 180 of file BaseDaemon.h.

Referenced by BaseDaemon(), getOptionParser(), initialisationBaseDaemon(), and parseArgument().

◆ p_startTimestamp

template<class _TBackend>
time_t Daemon< _TBackend >::p_startTimestamp
protectedinherited

Start timestamp of the current accumulation of statistics.

Definition at line 53 of file Daemon.h.

Referenced by run(), and sendStatToStatDaemon().

◆ p_statTimer

template<class _TBackend>
PTimer Daemon< _TBackend >::p_statTimer
protectedinherited

Timer to send statistics to the Stat Daemon.

Definition at line 51 of file Daemon.h.

Referenced by run().


The documentation for this class was generated from the following files: