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 221 of file doxygen.cpp.

Constructor & Destructor Documentation

◆ Statistics()

Statistics::Statistics ( )
inline

Definition at line 224 of file doxygen.cpp.

224{}

Member Function Documentation

◆ begin()

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

Definition at line 225 of file doxygen.cpp.

226 {
227 msg("%s", name);
228 stats.emplace_back(name,0);
229 startTime = std::chrono::steady_clock::now();
230 }
std::vector< stat > stats
Definition doxygen.cpp:261
std::chrono::steady_clock::time_point startTime
Definition doxygen.cpp:262
void msg(const char *fmt,...)
Definition message.cpp:98

References msg(), startTime, and stats.

◆ end()

void Statistics::end ( )
inline

Definition at line 231 of file doxygen.cpp.

232 {
233 std::chrono::steady_clock::time_point endTime = std::chrono::steady_clock::now();
234 stats.back().elapsed = static_cast<double>(std::chrono::duration_cast<
235 std::chrono::microseconds>(endTime - startTime).count())/1000000.0;
236 warn_flush();
237 }
void warn_flush()
Definition message.cpp:303

References startTime, stats, and warn_flush().

◆ print()

void Statistics::print ( )
inline

Definition at line 238 of file doxygen.cpp.

239 {
240 bool restore=FALSE;
242 {
244 restore=TRUE;
245 }
246 msg("----------------------\n");
247 for (const auto &s : stats)
248 {
249 msg("Spent %.6f seconds in %s",s.elapsed,s.name);
250 }
251 if (restore) Debug::setFlag(Debug::Time);
252 }
@ Time
Definition debug.h:34
static void clearFlag(const DebugMask mask)
Definition debug.cpp:125
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:135
static void setFlag(const DebugMask mask)
Definition debug.cpp:120
#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 262 of file doxygen.cpp.

Referenced by begin(), and end().

◆ stats

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

Definition at line 261 of file doxygen.cpp.

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


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