Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
Public Member Functions | List of all members
auryn::RealTimeMonitor Class Reference

Monitor class to record the system time in every timestep. More...

#include <RealTimeMonitor.h>

Inheritance diagram for auryn::RealTimeMonitor:
Inheritance graph
[legend]
Collaboration diagram for auryn::RealTimeMonitor:
Collaboration graph
[legend]

Public Member Functions

 RealTimeMonitor (std::string filename, AurynDouble start=1e-3, AurynDouble stop=100)
 
virtual ~RealTimeMonitor ()
 
void execute ()
 

Additional Inherited Members

- Protected Member Functions inherited from auryn::Monitor
virtual void open_output_file (std::string filename)
 
virtual void virtual_serialize (boost::archive::binary_oarchive &ar, const unsigned int version)
 
virtual void virtual_serialize (boost::archive::binary_iarchive &ar, const unsigned int version)
 
virtual void flush ()
 Flush to file. More...
 
 Monitor (std::string filename, std::string default_extension="dat")
 Standard constructor with file name. More...
 
 Monitor ()
 Constructor which does not open a text file for output. More...
 
std::string generate_filename (std::string name_hint="")
 Generates a default filename from the device ID. More...
 
virtual ~Monitor ()
 Standard destructor. More...
 
- Protected Member Functions inherited from auryn::Device
void init ()
 Standard initializer to be called by the constructor. More...
 
 Device ()
 Standard constructor. More...
 
void set_name (std::string s)
 Set device name. More...
 
std::string get_name ()
 Get device name. More...
 
int get_id ()
 Get numeric device id. More...
 
virtual ~Device ()
 Standard destructor. More...
 
virtual void evolve ()
 
- Protected Attributes inherited from auryn::Monitor
std::ofstream outfile
 
std::string fname
 
std::string default_file_extension
 
bool active
 Standard active switch. More...
 
- Protected Attributes inherited from auryn::Device
std::string device_name
 Identifying name for device. More...
 
bool active
 Standard active switch. More...
 

Detailed Description

Monitor class to record the system time in every timestep.

The RealTimeMonitor records every timestep RealTime (boost us clock) vs AurynTime

Constructor & Destructor Documentation

◆ RealTimeMonitor()

RealTimeMonitor::RealTimeMonitor ( std::string  filename,
AurynDouble  start = 1e-3,
AurynDouble  stop = 100 
)

Default Constructor

Parameters
30  : Monitor(filename)
31 {
33 
34  t_start = start/auryn_timestep;
35  t_stop = stop/auryn_timestep;
36 
37  ptime_offset = boost::posix_time::microsec_clock::local_time();
38 
39 #ifdef AURYN_CODE_USE_MPI
40  if (auryn::sys->get_com()->rank() == 0) {
41  std::string sendstring = boost::posix_time::to_iso_string(ptime_offset);
42  broadcast(*auryn::sys->get_com(), sendstring, 0);
43  } else {
44  std::string timestring;
45  broadcast(*auryn::sys->get_com(), timestring , 0);
46  ptime_offset = boost::posix_time::from_iso_string(timestring);
47  }
48 #endif // AURYN_CODE_USE_MPI
49 }
Monitor()
Constructor which does not open a text file for output.
Definition: Monitor.cpp:47
void register_device(Device *device)
Registers an instance of Device to the devices vector.
Definition: System.cpp:272
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
std::string string
Standard library string type which is imported into Auryn namespace.
Definition: auryn_definitions.h:156
Here is the call graph for this function:

◆ ~RealTimeMonitor()

RealTimeMonitor::~RealTimeMonitor ( )
virtual

Default Destructor

52 {
53 }

Member Function Documentation

◆ execute()

void RealTimeMonitor::execute ( )
virtual

Implementation of necessary execute() function.

Reimplemented from auryn::Device.

56 {
57  if ( t_stop > auryn::sys->get_clock() && t_start < auryn::sys->get_clock() ) {
58  boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time();
59  boost::posix_time::time_duration diff = now - ptime_offset;
60  outfile << (auryn::sys->get_clock()) << " " << diff.total_microseconds() << "\n";
61  }
62 }
std::ofstream outfile
Definition: Monitor.h:58
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
AurynTime get_clock()
Gets the current clock value in AurynTime.
Definition: System.cpp:231
Here is the call graph for this function:

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