delpi  0.0.1
DElta-complete LP solver
Loading...
Searching...
No Matches
delpi::IterationStats Class Reference

Dataclass collecting statistics about some operation or process. More...

#include <Stats.h>

Inheritance diagram for delpi::IterationStats:
delpi::Stats

Public Member Functions

 IterationStats (bool enabled, std::string class_name, std::string name_time="Time spent in Operations", std::string iterations_name="Total # of Iterations")
 Construct an IterationStats object.
std::string ToSegmentString () const override
 Convert the current state of the object to a formatted string, only including the specific part the Stat object is concerned about.
std::string ToString () const override
 Convert the current state of the object to a formatted string.
void Increase ()
 Increase the iteration counter by one.
void SetIterations (const unsigned int iterations)
 Set the total number of iterations.
Public Member Functions inherited from delpi::Stats
 Stats (bool enabled, std::string class_name, std::string name_time="Time spent in Operations")
 Construct a Stats object.

Private Attributes

std::atomic< unsigned int > iterations_
 Atomic counter for the total number of iterations.
std::string iterations_name_
 Name to give to the iteration operation.

Additional Inherited Members

Protected Attributes inherited from delpi::Stats
bool enabled_
 Flag to enable/disable the collection of statistics.
std::string class_name_
 Name of the class running the operation the Stats object is collecting statistics for.
std::string operations_name_
 Name of the operation the Stats object is collecting statistics for.

Detailed Description

Dataclass collecting statistics about some operation or process.

Not only does it collect the cumulative time spent in a given operation, but also the total number of iterations.

Definition at line 71 of file Stats.h.

Constructor & Destructor Documentation

◆ IterationStats()

delpi::IterationStats::IterationStats ( bool enabled,
std::string class_name,
std::string name_time = "Time spent in Operations",
std::string iterations_name = "Total # of Iterations" )
explicit

Construct an IterationStats object.

Parameters
enabledwhether the Stats object should be enabled or not. Its value is propagated to the timer_
class_namename of the class running the operation the Stats object is collecting statistics for
name_timename of the operation the Stats object is collecting statistics for
iterations_namename of the operation the Stats object is collecting statistics for

Definition at line 49 of file Stats.cpp.

Member Function Documentation

◆ Increase()

void delpi::IterationStats::Increase ( )

Increase the iteration counter by one.

Note
The iteration counter is atomic.

Definition at line 40 of file Stats.cpp.

◆ SetIterations()

void delpi::IterationStats::SetIterations ( const unsigned int iterations)
inline

Set the total number of iterations.

Parameters
iterationstotal number of iterations

Definition at line 108 of file Stats.h.

◆ ToSegmentString()

std::string delpi::IterationStats::ToSegmentString ( ) const
nodiscardoverridevirtual

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 from delpi::Stats.

Definition at line 44 of file Stats.cpp.

◆ ToString()

std::string delpi::IterationStats::ToString ( ) const
nodiscardoverridevirtual

Convert the current state of the object to a formatted string.

Returns
string representing the state of the Stats

Reimplemented from delpi::Stats.

Definition at line 47 of file Stats.cpp.


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