#include <logger.hh>
Public Member Functions | |
void | init (string tmpstr_in, int format_in=0) |
void | init (distributed_t *divine_ptr_in, std::string basename, int format=0) |
void | log_now () |
logger_t () | |
void | register_double (const log_double_t &functor, std::string description="") |
void | register_double (doublefunc_t func_ptr, std::string description="") |
void | register_int (intfunc_t func_ptr, std::string description="") |
void | register_slong_int (const log_slong_int_t &functor, std::string description="") |
void | register_ulong_int (const log_ulong_int_t &functor, std::string description="") |
void | register_unsigned (unsignedfunc_t func_ptr, std::string description="") |
void | set_storage (explicit_storage_t *storage_ptr) |
void | stop_SIGALRM () |
void | use_SIGALRM (unsigned int period=1) |
~logger_t () | |
Public Attributes | |
unsigned int | signal_period |
NOTE: Usage of the logger_t class slowdowns the execution of the algorithm.
logger_t | ( | ) |
Constructor does nothing. To initialize the instance of the class use the init member function.
~logger_t | ( | ) |
Destructor prints footer to the logfile and closes the logfile.
void init | ( | string | tmpstr_in, | |
int | format_in = 0 | |||
) |
The same as init(distributed_t * divine_ptr_in, std::string basename, int format), but divine_ptr_in = 0 implicitly.
References init().
void init | ( | distributed_t * | divine_ptr_in, | |
std::string | basename, | |||
int | format = 0 | |||
) |
This member function is called to initialize an instance of logger_t class. It accepts two obligatory parameters: a pointer to instance of distributed_t class and a base name of logfiles. (The base name is extended with .00, .01, .02, etc, by logger_t to distinguish individual logfiles.) The third parameter that gives the format of logfiles is optional (default value is 0, which corresponds to the format compatibile with plotlog script).
The method opens the logfile and print header into it according the chosen format. The function should be called after the set_storage and all the register member functions were called.
divine_ptr_in can be zero value (network-related values will be then zero too).
Referenced by init().
void log_now | ( | ) |
Forces the logger to log current values now. If signal/alarm mechanism is involved, then this function is typically called just before the destructor to log final values. If no signal/alarm mechanism is used, then this function is supposed to be called periodically.
References distributed_t::cluster_size, network_t::get_all_barriers_cnt(), network_t::get_all_buffers_flushes_cnt(), network_t::get_all_received_msgs_cnt(), network_t::get_all_sent_msgs_cnt(), network_t::get_sent_msgs_cnt_sent_to(), explicit_storage_t::get_states_stored(), distributed_t::network, vminfo_t::scan(), and vminfo_t::vmsize.
void register_double | ( | const log_double_t & | functor, | |
std::string | description = "" | |||
) |
This function can be used to register functor that will be called by the log_now function to obtained double f. p. value to be logged into logfile. The second optional parameter is a short (below 8 characters) description of the value that could be (depending on format) printed in the header of the file.
This can be used to log the number of states stored in the queue of states waiting for exploration, for example.
References gerr.
void register_double | ( | doublefunc_t | func_ptr, | |
std::string | description = "" | |||
) |
This function can be used to register function that will be called by the log_now function to obtained double value to be logged into logfile. The second optional parameter is a short (below 8 characters) description of the value that could be (depending on format) printed in the header of the file.
void register_int | ( | intfunc_t | func_ptr, | |
std::string | description = "" | |||
) |
This function can be used to register function that will be called by the log_now function to obtained int value to be logged into logfile. The second optional parameter is a short (below 8 characters) description of the value that could be (depending on format) printed in the header of the file.
void register_slong_int | ( | const log_slong_int_t & | functor, | |
std::string | description = "" | |||
) |
This function can be used to register functor that will be called by the log_now function to obtained signed int value to be logged into logfile. The second optional parameter is a short (below 8 characters) description of the value that could be (depending on format) printed in the header of the file.
This can be used to log the number of states stored in the queue of states waiting for exploration, for example.
References gerr.
void register_ulong_int | ( | const log_ulong_int_t & | functor, | |
std::string | description = "" | |||
) |
This function can be used to register functor that will be called by the log_now function to obtained unsigned int value to be logged into logfile. The second optional parameter is a short (below 8 characters) description of the value that could be (depending on format) printed in the header of the file.
This can be used to log the number of states stored in the queue of states waiting for exploration, for example.
References gerr.
void register_unsigned | ( | unsignedfunc_t | func_ptr, | |
std::string | description = "" | |||
) |
This function can be used to register function that will be called by the log_now function to obtained unsigned int value to be logged into logfile. The second optional parameter is a short (below 8 characters) description of the value that could be (depending on format) printed in the header of the file.
This can be used to log the number of states stored in the queue of states waiting for exploration, for example.
void set_storage | ( | explicit_storage_t * | storage_ptr | ) |
If logging of the number of states kept in the storage is requested, this member function should be used to set the pointer to instance of explicit_storage_t class.
Should be called before init member function.
void stop_SIGALRM | ( | ) |
Stops POSIX signal/alarm mechanism. (Starts ingoring incomming signals.)
void use_SIGALRM | ( | unsigned int | period = 1 |
) |
Starts POSIX signal/alarm mechanism to call log_now function periodically. The period is given in seconds. (One second is the shortest possible period.)
Should be called after the init member function.