smats  0.0.1
Satisfability Modulo Arithmetic Theories Symbols
Loading...
Searching...
No Matches
smats::Stats Class Reference

#include <stats.h>

Inheritance diagram for smats::Stats:
smats::IterationStats

Public Member Functions

 Stats (bool enabled, std::string class_name, std::string name_time="Time spent in Operations")
 
 Stats (const Stats &other)=default
 
Statsoperator= (const Stats &other)=default
 
Statsoperator+= (const Stats &other)
 
Stats operator+ (const Stats &other) const
 
bool enabled () const
 
Timerm_timer ()
 
const Timertimer () const
 
virtual std::string to_segment_string () const
 
virtual std::string to_string () const
 

Protected Attributes

bool enabled_
 Whether the stats measuring is enabled.
 
std::string class_name_
 Name of the class the stats are measuring.
 
std::string operations_name_
 Prompt to specify what operation the time has been measured of.
 

Private Attributes

Timer timer_
 Timer to measure the time spent in operations.
 

Detailed Description

Measure the statistics of the software.

Namely, measure the time spent in operations.

Constructor & Destructor Documentation

◆ Stats()

smats::Stats::Stats ( bool enabled,
std::string class_name,
std::string name_time = "Time spent in Operations" )
explicit

Construct a new Stats object.

The enabled flag is used to enable or disable the stats measuring. The class_name is the name of the class the stats are measuring, while the name_time is the prompt to specify what operation the time has been measured of. They are shown in the output of the to_string() method.

Parameters
enabledwhether the stats measuring is enabled
class_namename of the class the stats are measuring
name_timeprompt to specify what operation the time has been measured of

Member Function Documentation

◆ enabled()

bool smats::Stats::enabled ( ) const
inlinenodiscard

Check whether the stats is enabled.

Returns
true if the stats is enabled
false if the stats is not enabled

◆ m_timer()

Timer & smats::Stats::m_timer ( )
inlinenodiscard

Get read-write access to the timer of the stats.

Returns
timer of the stats

◆ timer()

const Timer & smats::Stats::timer ( ) const
inlinenodiscard

Get read-only access to the timer of the stats.

Returns
timer of the stats

◆ to_segment_string()

std::string smats::Stats::to_segment_string ( ) const
nodiscardvirtual

Convert the current state of the object to a formatted string, only including the specific part the Stat object is concerned about

Returns
string representing a partial state of the Stats

Reimplemented in smats::IterationStats.

◆ to_string()

std::string smats::Stats::to_string ( ) const
nodiscardvirtual

Convert the current state of the object to a formatted string

Returns
string representing the state of the Stats

Reimplemented in smats::IterationStats.


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