Skip to main content

The Statistics Class Reference

Declaration

class Statistics { ... }

Public Constructors Index

Statistics ()

Public Member Functions Index

voidbegin (const char *name)
voidend ()
voidprint ()

Private Member Attributes Index

std::vector< stat >stats
std::chrono::steady_clock::time_pointstartTime

Definition at line 228 of file doxygen.cpp.

Public Constructors

Statistics()

Statistics::Statistics ()
inline

Definition at line 231 of file doxygen.cpp.

Public Member Functions

begin()

void Statistics::begin (const char * name)
inline

Definition at line 232 of file doxygen.cpp.

232 void begin(const char *name)
233 {
234 msg("{}", name);
235 stats.emplace_back(name,0);
236 startTime = std::chrono::steady_clock::now();
237 }

References msg, startTime and stats.

end()

void Statistics::end ()
inline

Definition at line 238 of file doxygen.cpp.

238 void end()
239 {
240 std::chrono::steady_clock::time_point endTime = std::chrono::steady_clock::now();
241 stats.back().elapsed = static_cast<double>(std::chrono::duration_cast<
242 std::chrono::microseconds>(endTime - startTime).count())/1000000.0;
243 warn_flush();
244 }

References startTime, stats and warn_flush.

print()

void Statistics::print ()
inline

Definition at line 245 of file doxygen.cpp.

245 void print()
246 {
247 bool restore=FALSE;
249 {
251 restore=TRUE;
252 }
253 msg("----------------------\n");
254 for (const auto &s : stats)
255 {
256 msg("Spent {:.6f} seconds in {}",s.elapsed,s.name);
257 }
258 if (restore) Debug::setFlag(Debug::Time);
259 }

References Debug::clearFlag, FALSE, Debug::isFlagSet, msg, Debug::setFlag, stats, Debug::Time and TRUE.

Private Member Attributes

startTime

std::chrono::steady_clock::time_point Statistics::startTime

Definition at line 269 of file doxygen.cpp.

269 std::chrono::steady_clock::time_point startTime;

Referenced by begin and end.

stats

std::vector<stat> Statistics::stats

Definition at line 268 of file doxygen.cpp.

268 std::vector<stat> stats;

Referenced by begin, end and print.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.