Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::attributes::timer Class Reference

A class of an attribute that makes an attribute value of the time interval since construction. More...

#include <timer.hpp>

Inheritance diagram for boost::attributes::timer:
Collaboration diagram for boost::attributes::timer:

Public Types

typedef
utc_time_traits::time_type::time_duration_type 
value_type
 Attribute value type. More...
 

Public Member Functions

 timer ()
 Constructor. More...
 
 timer (cast_source const &source)
 Constructor for casting support. More...
 
bool operator! () const BOOST_NOEXCEPT
 Verifies that the factory is not in empty state. More...
 
attribute_value get_value () const
 
void swap (attribute &that) BOOST_NOEXCEPT
 The method swaps two factories (i.e. More...
 

Protected Member Functions

implget_impl () const BOOST_NOEXCEPT
 
void set_impl (intrusive_ptr< impl > p) BOOST_NOEXCEPT
 Sets the pointer to the factory implementation. More...
 

Detailed Description

A class of an attribute that makes an attribute value of the time interval since construction.

The timer attribute calculates the time passed since its construction and returns it on value acquisition. The attribute value type is boost::posix_time::time_duration.

On Windows platform there are two implementations of the attribute. The default one is more precise but a bit slower. This version uses QueryPerformanceFrequence/QueryPerformanceCounter API to calculate elapsed time.

There are known problems with these functions when used with some CPUs, notably AMD Athlon with Cool'n'Quiet technology enabled. See the following links for more information and possible resolutions:

http://support.microsoft.com/?scid=kb;en-us;895980 http://support.microsoft.com/?id=896256

In case if none of these solutions apply, you are free to define BOOST_LOG_NO_QUERY_PERFORMANCE_COUNTER macro to fall back to another implementation based on Boost.DateTime.

Member Typedef Documentation

Constructor & Destructor Documentation

boost::attributes::timer::timer ( )

Constructor.

Starts time counting.

boost::attributes::timer::timer ( cast_source const &  source)
explicit

Constructor for casting support.

Member Function Documentation

attribute_value boost::attribute::get_value ( ) const
inherited
Returns
The actual attribute value. It shall not return empty values (exceptions shall be used to indicate errors).
bool boost::attribute::operator! ( ) const
inlineinherited

Verifies that the factory is not in empty state.

Verifies that the factory is in empty state

void boost::attribute::set_impl ( intrusive_ptr< impl p)
inlineprotectedinherited

Sets the pointer to the factory implementation.

Parameters
pPointer to the implementation. Must not be NULL.

References boost::multiprecision::backends::p, and boost::intrusive_ptr< T >::swap().

Referenced by boost::attributes::counter< T >::counter().

void boost::attribute::swap ( attribute that)
inlineinherited

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