vrshoot

diff libs/assimp/boost/timer.hpp @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/assimp/boost/timer.hpp	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,72 @@
     1.4 +//  boost timer.hpp header file  ---------------------------------------------//
     1.5 +
     1.6 +//  Copyright Beman Dawes 1994-99.  Distributed under the Boost
     1.7 +//  Software License, Version 1.0. (See accompanying file
     1.8 +//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
     1.9 +
    1.10 +//  See http://www.boost.org/libs/timer for documentation.
    1.11 +
    1.12 +//  Revision History
    1.13 +//  01 Apr 01  Modified to use new <boost/limits.hpp> header. (JMaddock)
    1.14 +//  12 Jan 01  Change to inline implementation to allow use without library
    1.15 +//             builds. See docs for more rationale. (Beman Dawes) 
    1.16 +//  25 Sep 99  elapsed_max() and elapsed_min() added (John Maddock)
    1.17 +//  16 Jul 99  Second beta
    1.18 +//   6 Jul 99  Initial boost version
    1.19 +
    1.20 +#ifndef BOOST_TIMER_HPP
    1.21 +#define BOOST_TIMER_HPP
    1.22 +
    1.23 +//#include <boost/config.hpp>
    1.24 +#include <ctime>
    1.25 +//#include <boost/limits.hpp>
    1.26 +
    1.27 +# ifdef BOOST_NO_STDC_NAMESPACE
    1.28 +    namespace std { using ::clock_t; using ::clock; }
    1.29 +# endif
    1.30 +
    1.31 +
    1.32 +namespace boost {
    1.33 +
    1.34 +//  timer  -------------------------------------------------------------------//
    1.35 +
    1.36 +//  A timer object measures elapsed time.
    1.37 +
    1.38 +//  It is recommended that implementations measure wall clock rather than CPU
    1.39 +//  time since the intended use is performance measurement on systems where
    1.40 +//  total elapsed time is more important than just process or CPU time.
    1.41 +
    1.42 +//  Warnings: The maximum measurable elapsed time may well be only 596.5+ hours
    1.43 +//  due to implementation limitations.  The accuracy of timings depends on the
    1.44 +//  accuracy of timing information provided by the underlying platform, and
    1.45 +//  this varies a great deal from platform to platform.
    1.46 +
    1.47 +class timer
    1.48 +{
    1.49 + public:
    1.50 +         timer() { _start_time = std::clock(); } // postcondition: elapsed()==0
    1.51 +//         timer( const timer& src );      // post: elapsed()==src.elapsed()
    1.52 +//        ~timer(){}
    1.53 +//  timer& operator=( const timer& src );  // post: elapsed()==src.elapsed()
    1.54 +  void   restart() { _start_time = std::clock(); } // post: elapsed()==0
    1.55 +  double elapsed() const                  // return elapsed time in seconds
    1.56 +    { return  double(std::clock() - _start_time) / CLOCKS_PER_SEC; }
    1.57 +
    1.58 +  double elapsed_max() const   // return estimated maximum value for elapsed()
    1.59 +  // Portability warning: elapsed_max() may return too high a value on systems
    1.60 +  // where std::clock_t overflows or resets at surprising values.
    1.61 +  {
    1.62 +    return (double((std::numeric_limits<std::clock_t>::max)())
    1.63 +       - double(_start_time)) / double(CLOCKS_PER_SEC); 
    1.64 +  }
    1.65 +
    1.66 +  double elapsed_min() const            // return minimum value for elapsed()
    1.67 +   { return double(1)/double(CLOCKS_PER_SEC); }
    1.68 +
    1.69 + private:
    1.70 +  std::clock_t _start_time;
    1.71 +}; // timer
    1.72 +
    1.73 +} // namespace boost
    1.74 +
    1.75 +#endif  // BOOST_TIMER_HPP
    1.76 \ No newline at end of file