STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Static Public Member Functions | Public Types | Static Public Attributes | Protected Types | Protected Attributes
stapl::counter< T, GroupID, bool > Class Template Reference

Implements a configurable counter. More...

Public Member Functions

template<typename... Args>
 counter (Args &&... args)
 Creates a new counter and forwards the arguments to the underlying counter.
 
value_type read (void)
 Returns a reading of this counter.
 
value_type value (void) const noexcept
 Returns the cumulative difference between calls of start() and stop() since the last call to reset().
 
constexpr size_type calls (void) const noexcept
 Returns the number of times this counter has been started and stopped since the last call to reset().
 
constexpr bool active (void) const noexcept
 
void start (void)
 Starts this counter. More...
 
void restart (void)
 Restarts this counter. More...
 
value_type stop (void)
 Stops this counter. More...
 
void reset (void)
 Resets this counter.
 

Static Public Member Functions

static constexpr const char * native_name (void) noexcept
 Returns the native name of the counter as a C string.
 

Public Types

typedef T counter_type
 
typedef counter_type::value_type value_type
 
typedef unsigned int size_type
 
typedef int group_id_type
 

Static Public Attributes

static constexpr group_id_type group_id = GroupID
 The group id the counter belongs to.
 

Protected Types

typedef counter_group< GroupID > group_type
 

Protected Attributes

size_type m_calls
 
value_type m_value
 
counter_type m_counter
 
bool m_active
 

Detailed Description

template<typename T, int GroupID = 0, bool = disable_group_counter<GroupID>::value>
class stapl::counter< T, GroupID, bool >

Implements a configurable counter.

Template Parameters
TThe counter type.
GroupIDThe counter group the counter belongs to.

The counter objects have the ability to start, stop and resume collecting information. They have to be explicitly reset through the counter::reset() function to clear their internal state.

Member Function Documentation

◆ start()

template<typename T , int GroupID = 0, bool = disable_group_counter<GroupID>::value>
void stapl::counter< T, GroupID, bool >::start ( void  )

Starts this counter.

Warning
start() can be called only after construction or a call to stop().

◆ restart()

template<typename T , int GroupID = 0, bool = disable_group_counter<GroupID>::value>
void stapl::counter< T, GroupID, bool >::restart ( void  )

Restarts this counter.

This function is equivalent to calling reset() and start().

Warning
restart() can be called only after construction or a call to stop().

◆ stop()

template<typename T , int GroupID = 0, bool = disable_group_counter<GroupID>::value>
value_type stapl::counter< T, GroupID, bool >::stop ( void  )

Stops this counter.

Warning
stop can be called only after a call to start().
Returns
The cumulative difference between calls of start() and stop() since the last call to reset().

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