Doxygen
Loading...
Searching...
No Matches
Statistics Class Reference

Classes

struct  stat
 

Public Member Functions

 Statistics ()
 
void begin (const char *name)
 
void end ()
 
void print ()
 

Private Attributes

std::vector< statstats
 
std::chrono::steady_clock::time_point startTime
 

Detailed Description

Definition at line 228 of file doxygen.cpp.

Constructor & Destructor Documentation

◆ Statistics()

Statistics::Statistics ( )
inline

Definition at line 231 of file doxygen.cpp.

231{}

Member Function Documentation

◆ begin()

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

Definition at line 232 of file doxygen.cpp.

233 {
234 msg("{}", name);
235 stats.emplace_back(name,0);
236 startTime = std::chrono::steady_clock::now();
237 }
std::vector< stat > stats
Definition doxygen.cpp:268
std::chrono::steady_clock::time_point startTime
Definition doxygen.cpp:269
#define msg(fmt,...)
Definition message.h:94

References msg, startTime, and stats.

◆ end()

void Statistics::end ( )
inline

Definition at line 238 of file doxygen.cpp.

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 }
void warn_flush()
Definition message.cpp:211

References startTime, stats, and warn_flush().

◆ print()

void Statistics::print ( )
inline

Definition at line 245 of file doxygen.cpp.

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 }
@ Time
Definition debug.h:35
static void clearFlag(const DebugMask mask)
Definition debug.cpp:122
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:132
static void setFlag(const DebugMask mask)
Definition debug.cpp:117
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34

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

Member Data Documentation

◆ startTime

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

Definition at line 269 of file doxygen.cpp.

Referenced by begin(), and end().

◆ stats

std::vector<stat> Statistics::stats
private

Definition at line 268 of file doxygen.cpp.

Referenced by begin(), end(), and print().


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