delphyne
SimulationRunStats Class Reference

Detailed Description

A class that keeps statistics of a single simulation run.

An interactive session is usually composed of one or more simulation runs, depending on the interactions with the external world. Each simulation run captures the moment it started (both in simulation and real time), the number of simulation steps executed, the timestamps for that last step (again, in simulation and real time) and a flag indicating if the run has finished (once this happens no more steps can be recorded).

#include <src/backend/simulation_run_stats.h>

Public Member Functions

 SimulationRunStats (double start_simtime, double expected_realtime_rate)
 Creates a new simulation run, starting at start_simtime. More...
 
 SimulationRunStats (double start_simtime, double expected_realtime_rate, const TimePoint &start_realtime)
 Creates a new simulation run. More...
 
void StepExecuted (double simtime)
 Records that a step was executed by the simulator. More...
 
void SetRealtime (const TimePoint &realtime)
 Records the current real time, typically used after a simulation step has occurred. More...
 
double ElapsedSimtime () const
 Returns the simulation time difference, in seconds, since the run started until the last step. More...
 
double ElapsedRealtime () const
 Returns the real time difference, in seconds, since the run started until the last step. More...
 
void RunFinished ()
 Indicates that the run has finished. More...
 
double EffectiveRealtimeRate ()
 Returns the actual real time rate based on elapsed simulation and real time. More...
 
int get_executed_steps () const
 Returns the number of executed steps. More...
 
double get_start_simtime () const
 Returns the start time, based on simulator clock. More...
 
double get_last_step_simtime () const
 Returns the simulation time of the last recorded step. More...
 
const TimePointget_start_realtime () const
 Returns the start time, based on real time clock. More...
 
const TimePointget_last_step_realtime () const
 Returns the real time of the last recorded step. More...
 
double get_expected_realtime_rate () const
 

Constructor & Destructor Documentation

◆ SimulationRunStats() [1/2]

SimulationRunStats ( double  start_simtime,
double  expected_realtime_rate 
)
explicit

Creates a new simulation run, starting at start_simtime.

Assumes that the real-time start is the current time.

Parameters
[in]start_simtimeThe time the simulation started, in seconds, given by the simulator clock.
[in]expected_realtime_rateThe desired real time based in the simulation runner configuration.

◆ SimulationRunStats() [2/2]

SimulationRunStats ( double  start_simtime,
double  expected_realtime_rate,
const TimePoint start_realtime 
)
explicit

Creates a new simulation run.

Parameters
[in]start_simtimeThe time the simulation started, in seconds, given by the simulator clock.
[in]expected_realtime_rateThe desired real time based in the simulation runner configuration.
[in]start_realtimeThe time the simulation started, given by the wall clock.

Member Function Documentation

◆ EffectiveRealtimeRate()

double EffectiveRealtimeRate ( )

Returns the actual real time rate based on elapsed simulation and real time.

Precondition
executed_steps_ > 0

◆ ElapsedRealtime()

double ElapsedRealtime ( ) const

Returns the real time difference, in seconds, since the run started until the last step.

◆ ElapsedSimtime()

double ElapsedSimtime ( ) const

Returns the simulation time difference, in seconds, since the run started until the last step.

◆ get_executed_steps()

int get_executed_steps ( ) const

Returns the number of executed steps.

◆ get_expected_realtime_rate()

double get_expected_realtime_rate ( ) const

◆ get_last_step_realtime()

const TimePoint& get_last_step_realtime ( ) const

Returns the real time of the last recorded step.

◆ get_last_step_simtime()

double get_last_step_simtime ( ) const

Returns the simulation time of the last recorded step.

◆ get_start_realtime()

const TimePoint& get_start_realtime ( ) const

Returns the start time, based on real time clock.

◆ get_start_simtime()

double get_start_simtime ( ) const

Returns the start time, based on simulator clock.

◆ RunFinished()

void RunFinished ( )

Indicates that the run has finished.

◆ SetRealtime()

void SetRealtime ( const TimePoint realtime)

Records the current real time, typically used after a simulation step has occurred.

Parameters
[in]realtimeThe time the step was executed, given by the wall clock.

◆ StepExecuted()

void StepExecuted ( double  simtime)

Records that a step was executed by the simulator.

Parameters
[in]simtimeThe time the step was executed, in seconds, given by the simulator clock.

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