]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/sort/common/time_measure.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / sort / common / time_measure.hpp
1 //----------------------------------------------------------------------------
2 /// @file time_measure.hpp
3 /// @brief This class is done in order to simplify the time measure in the
4 /// benchmaark programs
5 ///
6 /// @author Copyright (c) 2010 2015 Francisco José Tapia (fjtapia@gmail.com )\n
7 /// Distributed under the Boost Software License, Version 1.0.\n
8 /// ( See accompanyingfile LICENSE_1_0.txt or copy at
9 /// http://www.boost.org/LICENSE_1_0.txt )
10 /// @version 0.1
11 ///
12 /// @remarks
13 //-----------------------------------------------------------------------------
14 #ifndef __BOOST_SORT_PARALLEL_TOOLS_TIME_MEASURE_HPP
15 #define __BOOST_SORT_PARALLEL_TOOLS_TIME_MEASURE_HPP
16
17 #include <chrono>
18
19 namespace boost
20 {
21 namespace sort
22 {
23 namespace common
24 {
25
26 namespace chrn = std::chrono;
27 //
28 //***************************************************************************
29 // D E F I N I T I O N S
30 //***************************************************************************
31 typedef chrn::steady_clock::time_point time_point;
32
33 time_point now ( );
34 double subtract_time ( const time_point & t1, const time_point & t2 );
35 //
36 //---------------------------------------------------------------------------
37 // function : now
38 /// @brief return the time system in a internal format ( steady_clock)
39 /// @return time in steady_clock format
40 //---------------------------------------------------------------------------
41 time_point now ( ) { return chrn::steady_clock::now( ); };
42 //
43 //---------------------------------------------------------------------------
44 // function : subtract_time
45 /// @brief return the time in double format
46 /// @param [in] t1 : first time in time_point format
47 /// @param [in] t2 : second time in time_point format
48 /// @return time in seconds of the difference of t1 - t2
49 //---------------------------------------------------------------------------
50 double subtract_time ( const time_point & t1, const time_point & t2 )
51 { //------------------------ begin ---------------------------------
52 chrn::duration<double> time_span =
53 chrn::duration_cast < chrn::duration < double > > ( t1 - t2 );
54 return time_span.count( );
55 };
56
57 //***************************************************************************
58 };// End namespace benchmark
59 };// End namespace sort
60 };// End namespace boost
61 //***************************************************************************
62 #endif