SST/macro
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
sstmac::stat_collector Class Referenceabstract

A type of logger that collects some kind of statistic and outputs to a file during or at the end of a simulation. More...

#include <stat_collector.h>

Inheritance diagram for sstmac::stat_collector:
Inheritance graph
Collaboration diagram for sstmac::stat_collector:
Collaboration graph

Public Member Functions

virtual ~stat_collector ()
 
virtual void simulation_finished (timestamp end)=0
 This is to notify that the statistics collector is done. More...
 
virtual void dump_local_data ()=0
 After post-processing, this notifies the collector to dump data to a file. More...
 
virtual void dump_global_data ()=0
 After post-processing, this notifies the collector to dump data to a file. More...
 
virtual void global_reduce (parallel_runtime *rt)=0
 
virtual void reduce (stat_collector *coll)=0
 
virtual void clear ()=0
 
virtual stat_collectorclone () const =0
 
virtual std::string to_string () const
 
virtual void init_factory_params (sprockit::sim_parameters *params)
 
bool registered () const
 
virtual void set_id (int id)
 
int id () const
 
void set_registered (bool reg)
 
void add_suffix (const std::string &suffix)
 
std::string fileroot () const
 
- Public Member Functions inherited from sprockit::factory_type
virtual void init_factory_params (sim_parameters *params)
 
virtual void finalize_init ()
 

Static Public Member Functions

static stat_collectoroptional_build (sprockit::sim_parameters *params, const std::string &ns, const std::string &deflt, const char *suffix)
 

Protected Member Functions

 stat_collector ()
 
void clone_into (stat_collector *cln) const
 

Static Protected Member Functions

static bool check_open (std::fstream &myfile, const std::string &fname, std::ios::openmode flags=std::ios::out)
 Check to see if the file is open. More...
 

Protected Attributes

bool registered_
 
int id_
 
std::string fileroot_
 

Detailed Description

A type of logger that collects some kind of statistic and outputs to a file during or at the end of a simulation.

Usually, a static instance of this class should be used, because no merging of stat objects takes place, which means you'll get one file for each stat object.

Definition at line 31 of file stat_collector.h.

Constructor & Destructor Documentation

virtual sstmac::stat_collector::~stat_collector ( )
virtual
sstmac::stat_collector::stat_collector ( )
inlineprotected

Definition at line 109 of file stat_collector.h.

References check_open(), and clone_into().

Here is the call graph for this function:

Member Function Documentation

void sstmac::stat_collector::add_suffix ( const std::string &  suffix)

Referenced by set_registered().

static bool sstmac::stat_collector::check_open ( std::fstream &  myfile,
const std::string &  fname,
std::ios::openmode  flags = std::ios::out 
)
staticprotected

Check to see if the file is open.

If not, try and open it and set the current output stream to it, and throw an sprockit::spkt_error if something goes wrong.

Returns

Referenced by stat_collector().

virtual void sstmac::stat_collector::clear ( )
pure virtual
virtual stat_collector* sstmac::stat_collector::clone ( ) const
pure virtual
void sstmac::stat_collector::clone_into ( stat_collector cln) const
protected

Referenced by stat_collector().

virtual void sstmac::stat_collector::dump_global_data ( )
pure virtual

After post-processing, this notifies the collector to dump data to a file.

Parameters
nameThe root of the filename to dump to

Implemented in sstmac::hw::stat_bytes_sent, sstmac::sw::ftq_calendar, sstmac::sw::graph_viz, sstmac::event_trace, sstmac::stat_spyplot, sstmac::location_trace, sstmac::stat_histogram, sstmac::stat_global_int, sstmac::stat_local_double, and sstmac::stat_local_int.

virtual void sstmac::stat_collector::dump_local_data ( )
pure virtual

After post-processing, this notifies the collector to dump data to a file.

Parameters
nameThe root of the filename to dump to

Implemented in sstmac::hw::stat_bytes_sent, sstmac::sw::ftq_calendar, sstmac::sw::graph_viz, sstmac::event_trace, sstmac::stat_spyplot, sstmac::location_trace, sstmac::stat_histogram, sstmac::stat_global_int, sstmac::stat_local_double, and sstmac::stat_local_int.

std::string sstmac::stat_collector::fileroot ( ) const
inline

Definition at line 97 of file stat_collector.h.

References sstmac::hw::routing::deflt, fileroot_, and optional_build().

Here is the call graph for this function:

virtual void sstmac::stat_collector::global_reduce ( parallel_runtime rt)
pure virtual
int sstmac::stat_collector::id ( ) const
inline

Definition at line 84 of file stat_collector.h.

References id_.

Referenced by set_id().

virtual void sstmac::stat_collector::init_factory_params ( sprockit::sim_parameters *  params)
virtual
static stat_collector* sstmac::stat_collector::optional_build ( sprockit::sim_parameters *  params,
const std::string &  ns,
const std::string &  deflt,
const char *  suffix 
)
static

Referenced by fileroot(), and sstmac::optional_stats().

virtual void sstmac::stat_collector::reduce ( stat_collector coll)
pure virtual
bool sstmac::stat_collector::registered ( ) const
inline

Definition at line 74 of file stat_collector.h.

References registered_.

virtual void sstmac::stat_collector::set_id ( int  id)
inlinevirtual
void sstmac::stat_collector::set_registered ( bool  reg)
inline

Definition at line 89 of file stat_collector.h.

References add_suffix(), and registered_.

Here is the call graph for this function:

virtual void sstmac::stat_collector::simulation_finished ( timestamp  end)
pure virtual

This is to notify that the statistics collector is done.

Do any necessary data post-processing, but do NOT dump to file

Implemented in sstmac::hw::stat_bytes_sent, sstmac::sw::ftq_calendar, sstmac::sw::graph_viz, sstmac::location_trace, sstmac::stat_spyplot, sstmac::event_trace, sstmac::stat_histogram, sstmac::stat_global_int, sstmac::stat_local_double, and sstmac::stat_local_int.

virtual std::string sstmac::stat_collector::to_string ( ) const
inlinevirtual

Reimplemented in sstmac::sw::ftq_calendar, sstmac::stat_spyplot_png, sstmac::sw::graph_viz, sstmac::stat_spyplot, and sstmac::location_trace.

Definition at line 66 of file stat_collector.h.

References init_factory_params().

Here is the call graph for this function:

Member Data Documentation

std::string sstmac::stat_collector::fileroot_
protected

Definition at line 130 of file stat_collector.h.

Referenced by fileroot().

int sstmac::stat_collector::id_
protected

Definition at line 129 of file stat_collector.h.

Referenced by id(), and set_id().

bool sstmac::stat_collector::registered_
protected

Definition at line 128 of file stat_collector.h.

Referenced by registered(), and set_registered().


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