NEST main@caf0ae8
 
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 = std::conditional_t< use_timer_array, std::vector< timers::StopwatchTimer< ClockType > >, timers::StopwatchTimer< ClockType > >
 
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 = std::conditional_t< use_timer_array, std::vector< timers::StopwatchTimer< ClockType > >, timers::StopwatchTimer< ClockType > >
private

◆ 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(), nest::VPManager::get_thread_id(), nest::kernel(), and nest::KernelManager::vp_manager.

Referenced by nest::SimulationManager::update_().

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(), nest::kernel(), and nest::KernelManager::vp_manager.

Referenced by nest::KernelManager::get_status(), nest::ConnectionManager::get_status(), nest::EventDeliveryManager::get_status(), nest::NodeManager::get_status(), and nest::SimulationManager::get_status().

Here is the call graph for this function:
Here is the caller 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(), nest::VPManager::get_thread_id(), nest::kernel(), and nest::KernelManager::vp_manager.

Here is the call 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(), nest::VPManager::get_thread_id(), nest::kernel(), and nest::KernelManager::vp_manager.

Here is the call graph for this function:

◆ reset()

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

◆ 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

◆ enable_timer

template<StopwatchGranularity detailed_timer, StopwatchParallelism threaded_timer>
constexpr 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>
constexpr 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: