NEST main@f146f75
Loading...
Searching...
No Matches
nest::Stopwatch< detailed_timer, threaded_timer > Class Template Reference

This template has two template arguments. More...

#include <stopwatch.h>

Inheritance diagram for nest::Stopwatch< detailed_timer, threaded_timer >:
[legend]

Public Member Functions

void start ()
void stop ()
double elapsed (timers::timeunit_t timeunit=timers::timeunit_t::SECONDS) const
void reset ()
void print (const std::string &msg="", timers::timeunit_t timeunit=timers::timeunit_t::SECONDS, std::ostream &os=std::cout) const
void get_status (Dictionary &d, const std::string &walltime_name, const std::string &cputime_name) const

Private Types

template<clockid_t ClockType>
using InternalTimerType
template<clockid_t ClockType>
using StopwatchTimerType = std::conditional_t< enable_timer, InternalTimerType< ClockType >, NoOpStopwatch >

Private Member Functions

bool is_running_ () const

Private Attributes

StopwatchTimerType< CLOCK_MONOTONIC > walltime_timer_
StopwatchTimerType< CLOCK_THREAD_CPUTIME_ID > cputime_timer_

Static Private Attributes

static constexpr bool enable_timer = detailed_timer == StopwatchGranularity::Normal or use_detailed_timers
static constexpr bool use_timer_array = threaded_timer == StopwatchParallelism::Threaded and use_threaded_timers

Detailed Description

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
class nest::Stopwatch< detailed_timer, threaded_timer >

This template has two template arguments.

The first one "detailed_timer" controls the granularity of the stopwatch, i.e., if the timer is considered a normal or detailed timer. The second one "threaded_timer" defines if the timer is supposed to be measured by each thread individually. In case a timer is specified as threaded, but threaded timers are turned off globally, the stopwatch will run in master-only mode instead.

In all cases, both the (monotonic) wall-time and cpu time are measured.

Member Typedef Documentation

◆ InternalTimerType

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
template<clockid_t ClockType>
using nest::Stopwatch< detailed_timer, threaded_timer >::InternalTimerType
private
Initial value:
std::conditional_t< use_timer_array,
std::vector< timers::StopwatchTimer< ClockType > >,
static constexpr bool use_timer_array
Definition stopwatch.h:304
This class represents a single timer which measures the execution time of a single thread for a given...
Definition stopwatch.h:114

◆ StopwatchTimerType

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
template<clockid_t ClockType>
using nest::Stopwatch< detailed_timer, threaded_timer >::StopwatchTimerType = std::conditional_t< enable_timer, InternalTimerType< ClockType >, NoOpStopwatch >
private

Member Function Documentation

◆ elapsed()

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
double nest::Stopwatch< detailed_timer, threaded_timer >::elapsed ( timers::timeunit_t timeunit = timers::timeunit_t::SECONDS) const

References nest::VPManager::assert_thread_parallel(), elapsed(), enable_timer, nest::VPManager::get_thread_id(), nest::kernel(), use_timer_array, nest::KernelManager::vp_manager, and walltime_timer_.

Referenced by elapsed().

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

◆ get_status()

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
void nest::Stopwatch< detailed_timer, threaded_timer >::get_status ( Dictionary & d,
const std::string & walltime_name,
const std::string & cputime_name ) const

References nest::VPManager::assert_single_threaded(), cputime_timer_, enable_timer, nest::kernel(), use_timer_array, nest::KernelManager::vp_manager, and walltime_timer_.

Here is the call graph for this function:

◆ is_running_()

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
bool nest::Stopwatch< detailed_timer, threaded_timer >::is_running_ ( ) const
private

References nest::VPManager::assert_thread_parallel(), enable_timer, nest::VPManager::get_thread_id(), is_running_(), nest::kernel(), use_timer_array, nest::KernelManager::vp_manager, and walltime_timer_.

Referenced by is_running_().

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

◆ print()

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
void nest::Stopwatch< detailed_timer, threaded_timer >::print ( const std::string & msg = "",
timers::timeunit_t timeunit = timers::timeunit_t::SECONDS,
std::ostream & os = std::cout ) const

References nest::VPManager::assert_thread_parallel(), enable_timer, nest::VPManager::get_thread_id(), nest::kernel(), use_timer_array, nest::KernelManager::vp_manager, and walltime_timer_.

Here is the call graph for this function:

◆ reset()

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
void nest::Stopwatch< detailed_timer, threaded_timer >::reset ( )

References nest::VPManager::assert_single_threaded(), cputime_timer_, enable_timer, nest::VPManager::get_num_threads(), nest::kernel(), use_timer_array, nest::KernelManager::vp_manager, and walltime_timer_.

Here is the call graph for this function:

◆ start()

◆ stop()

Member Data Documentation

◆ cputime_timer_

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
StopwatchTimerType< CLOCK_THREAD_CPUTIME_ID > nest::Stopwatch< detailed_timer, threaded_timer >::cputime_timer_
private

Referenced by get_status(), reset(), start(), and stop().

◆ enable_timer

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
bool nest::Stopwatch< detailed_timer, threaded_timer >::enable_timer = detailed_timer == StopwatchGranularity::Normal or use_detailed_timers
staticconstexprprivate

◆ use_timer_array

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
bool nest::Stopwatch< detailed_timer, threaded_timer >::use_timer_array = threaded_timer == StopwatchParallelism::Threaded and use_threaded_timers
staticconstexprprivate

◆ walltime_timer_

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
StopwatchTimerType< CLOCK_MONOTONIC > nest::Stopwatch< detailed_timer, threaded_timer >::walltime_timer_
private

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