Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/log/attributes/timer.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *          Copyright Andrey Semashev 2007 - 2015.
0003  * Distributed under the Boost Software License, Version 1.0.
0004  *    (See accompanying file LICENSE_1_0.txt or copy at
0005  *          http://www.boost.org/LICENSE_1_0.txt)
0006  */
0007 /*!
0008  * \file   timer.hpp
0009  * \author Andrey Semashev
0010  * \date   02.12.2007
0011  *
0012  * The header contains implementation of a stop watch attribute.
0013  */
0014 
0015 #ifndef BOOST_LOG_ATTRIBUTES_TIMER_HPP_INCLUDED_
0016 #define BOOST_LOG_ATTRIBUTES_TIMER_HPP_INCLUDED_
0017 
0018 #include <boost/log/detail/config.hpp>
0019 #include <boost/log/attributes/attribute.hpp>
0020 #include <boost/log/attributes/attribute_cast.hpp>
0021 #include <boost/log/attributes/time_traits.hpp>
0022 #include <boost/log/detail/header.hpp>
0023 
0024 #ifdef BOOST_HAS_PRAGMA_ONCE
0025 #pragma once
0026 #endif
0027 
0028 namespace boost {
0029 
0030 BOOST_LOG_OPEN_NAMESPACE
0031 
0032 namespace attributes {
0033 
0034 /*!
0035  * \brief A class of an attribute that makes an attribute value of the time interval since construction
0036  *
0037  * The timer attribute calculates the time passed since its construction and returns it on value acquisition.
0038  * The attribute value type is <tt>boost::posix_time::time_duration</tt>.
0039  *
0040  * On Windows platform there are two implementations of the attribute. The default one is more precise but
0041  * a bit slower. This version uses <tt>QueryPerformanceFrequence</tt>/<tt>QueryPerformanceCounter</tt> API
0042  * to calculate elapsed time.
0043  *
0044  * There are known problems with these functions when used with some CPUs, notably AMD Athlon with
0045  * Cool'n'Quiet technology enabled. See the following links for more information and possible resolutions:
0046  *
0047  * http://support.microsoft.com/?scid=kb;en-us;895980
0048  * http://support.microsoft.com/?id=896256
0049  *
0050  * In case if none of these solutions apply, you are free to define <tt>BOOST_LOG_NO_QUERY_PERFORMANCE_COUNTER</tt> macro to
0051  * fall back to another implementation based on Boost.DateTime.
0052  */
0053 class BOOST_LOG_API timer :
0054     public attribute
0055 {
0056 public:
0057     //! Attribute value type
0058     typedef utc_time_traits::time_type::time_duration_type value_type;
0059 
0060 private:
0061     //! Factory implementation
0062     class BOOST_SYMBOL_VISIBLE impl;
0063 
0064 public:
0065     /*!
0066      * Constructor. Starts time counting.
0067      */
0068     timer();
0069     /*!
0070      * Constructor for casting support
0071      */
0072     explicit timer(cast_source const& source);
0073 };
0074 
0075 } // namespace attributes
0076 
0077 BOOST_LOG_CLOSE_NAMESPACE // namespace log
0078 
0079 } // namespace boost
0080 
0081 #include <boost/log/detail/footer.hpp>
0082 
0083 #endif // BOOST_LOG_ATTRIBUTES_TIMER_HPP_INCLUDED_