14#include "dlinear/util/Timer.h"
39 explicit Stats(
bool enabled, std::string class_name, std::string name_time =
"Time spent in Operations");
41 Stats &operator=(
const Stats &other) =
default;
42 virtual ~Stats() =
default;
63 [[nodiscard]]
virtual std::string
ToString()
const;
84 explicit IterationStats(
bool enabled, std::string class_name, std::string name_time =
"Time spent in Operations",
85 std::string iterations_name =
"Total # of Iterations");
94 [[nodiscard]] std::string
ToString()
const override;
106 void operator++(
int);
109std::ostream &operator<<(std::ostream &os,
const Stats &stats);
110std::ostream &operator<<(std::ostream &os,
const IterationStats &stats);
Dataclass collecting statistics about some operation or process.
std::string ToSegmentString() const override
Convert the current state of the object to a formatted string, only including the specific part the S...
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::atomic< unsigned int > iterations_
Atomic counter for the total number of iterations.
unsigned int iterations() const
Get read-only access to the iterations of the stats.
std::string ToString() const override
Convert the current state of the object to a formatted string.
std::string iterations_name_
Name to give to the iteration operation.
void Increase()
Increase the iteration counter by one.
Dataclass collecting statistics about some operation or process.
std::string class_name_
Name of the class running the operation the Stats object is collecting statistics for.
Timer timer_
Timer object to measure the cumulative time spent in the operation.
Stats(bool enabled, std::string class_name, std::string name_time="Time spent in Operations")
Construct a Stats object.
Timer & m_timer()
Get read-write access to the timer of the stats.
const Timer & timer() const
Get read-only access to the timer of the stats.
virtual std::string ToSegmentString() const
Convert the current state of the object to a formatted string, only including the specific part the S...
bool enabled_
Flag to enable/disable the collection of statistics.
bool enabled() const
Check whether the stats is enabled.
virtual std::string ToString() const
Convert the current state of the object to a formatted string.
std::string operations_name_
Name of the operation the Stats object is collecting statistics for.
Timer class using the a steady clock.
Global namespace for the dlinear library.