3D City v-1.0
Computer Graphics Project
timer Class Reference

A helper class to measure execution time for benchmarking purposes. More...

#include <thread_pool.hpp>

Public Member Functions

void start ()
 Start (or restart) measuring time. More...
 
void stop ()
 Stop measuring time and store the elapsed time since start(). More...
 
i64 ms () const
 Get the number of milliseconds that have elapsed between start() and stop(). More...
 

Private Types

typedef std::int_fast64_t i64
 

Private Attributes

std::chrono::time_point< std::chrono::steady_clock > start_time = std::chrono::steady_clock::now()
 The time point when measuring started. More...
 
std::chrono::duration< double > elapsed_time = std::chrono::duration<double>::zero()
 The duration that has elapsed between start() and stop(). More...
 

Detailed Description

A helper class to measure execution time for benchmarking purposes.

Definition at line 447 of file thread_pool.hpp.

Member Typedef Documentation

◆ i64

typedef std::int_fast64_t timer::i64
private

Definition at line 448 of file thread_pool.hpp.

Member Function Documentation

◆ ms()

i64 timer::ms ( ) const
inline

Get the number of milliseconds that have elapsed between start() and stop().

Returns
The number of milliseconds.

Definition at line 470 of file thread_pool.hpp.

◆ start()

void timer::start ( )
inline

Start (or restart) measuring time.

Definition at line 454 of file thread_pool.hpp.

◆ stop()

void timer::stop ( )
inline

Stop measuring time and store the elapsed time since start().

Definition at line 461 of file thread_pool.hpp.

Member Data Documentation

◆ elapsed_time

std::chrono::duration<double> timer::elapsed_time = std::chrono::duration<double>::zero()
private

The duration that has elapsed between start() and stop().

Definition at line 483 of file thread_pool.hpp.

◆ start_time

std::chrono::time_point<std::chrono::steady_clock> timer::start_time = std::chrono::steady_clock::now()
private

The time point when measuring started.

Definition at line 478 of file thread_pool.hpp.