Wildmeshing Toolkit
wmtk::utils::StopWatch Class Reference

#include <Stopwatch.hpp>

Public Member Functions

 StopWatch (const std::string &name)
 
 StopWatch (const std::string &name, const spdlog::level::level_enum log_level)
 
virtual ~StopWatch ()
 
void start ()
 
void stop ()
 
template<typename T = std::chrono::seconds>
int64_t getElapsedTime ()
 
void log_msg ()
 

Private Attributes

std::string m_name
 
spdlog::level::level_enum m_log_level = spdlog::level::info
 
std::chrono::high_resolution_clock::time_point m_start
 
std::chrono::high_resolution_clock::time_point m_stop
 
bool m_is_running = false
 

Detailed Description

Definition at line 10 of file Stopwatch.hpp.

Constructor & Destructor Documentation

◆ StopWatch() [1/2]

wmtk::utils::StopWatch::StopWatch ( const std::string &  name)

Definition at line 9 of file Stopwatch.cpp.

◆ StopWatch() [2/2]

wmtk::utils::StopWatch::StopWatch ( const std::string &  name,
const spdlog::level::level_enum  log_level 
)

Definition at line 13 of file Stopwatch.cpp.

References start().

Here is the call graph for this function:

◆ ~StopWatch()

wmtk::utils::StopWatch::~StopWatch ( )
virtual

Definition at line 20 of file Stopwatch.cpp.

References log_msg(), m_is_running, and stop().

Here is the call graph for this function:

Member Function Documentation

◆ getElapsedTime()

template<typename T >
int64_t wmtk::utils::StopWatch::getElapsedTime
inline

Definition at line 37 of file Stopwatch.hpp.

References m_start, and m_stop.

◆ log_msg()

void wmtk::utils::StopWatch::log_msg ( )
inline

Definition at line 43 of file Stopwatch.cpp.

References wmtk::logger(), m_log_level, and m_name.

Referenced by ~StopWatch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void wmtk::utils::StopWatch::start ( )

Definition at line 28 of file Stopwatch.cpp.

References m_is_running, and m_start.

Referenced by StopWatch().

Here is the caller graph for this function:

◆ stop()

void wmtk::utils::StopWatch::stop ( )

Definition at line 34 of file Stopwatch.cpp.

References m_is_running, and m_stop.

Referenced by ~StopWatch().

Here is the caller graph for this function:

Member Data Documentation

◆ m_is_running

bool wmtk::utils::StopWatch::m_is_running = false
private

Definition at line 33 of file Stopwatch.hpp.

Referenced by start(), stop(), and ~StopWatch().

◆ m_log_level

spdlog::level::level_enum wmtk::utils::StopWatch::m_log_level = spdlog::level::info
private

Definition at line 29 of file Stopwatch.hpp.

Referenced by log_msg().

◆ m_name

std::string wmtk::utils::StopWatch::m_name
private

Definition at line 28 of file Stopwatch.hpp.

Referenced by log_msg().

◆ m_start

std::chrono::high_resolution_clock::time_point wmtk::utils::StopWatch::m_start
private

Definition at line 30 of file Stopwatch.hpp.

Referenced by getElapsedTime(), and start().

◆ m_stop

std::chrono::high_resolution_clock::time_point wmtk::utils::StopWatch::m_stop
private

Definition at line 31 of file Stopwatch.hpp.

Referenced by getElapsedTime(), and stop().


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