comparison DEPENDENCIES/generic/include/boost/chrono/process_cpu_clocks.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
1 // boost/chrono/process_cpu_clocks.hpp -----------------------------------------------------------// 1 // boost/chrono/process_cpu_clocks.hpp -----------------------------------------------------------//
2 2
3 // Copyright 2009-2011 Vicente J. Botet Escriba 3 // Copyright 2009-2011 Vicente J. Botet Escriba
4 // Copyright (c) Microsoft Corporation 2014
4 5
5 // Distributed under the Boost Software License, Version 1.0. 6 // Distributed under the Boost Software License, Version 1.0.
6 // See http://www.boost.org/LICENSE_1_0.txt 7 // See http://www.boost.org/LICENSE_1_0.txt
7 8
8 // See http://www.boost.org/libs/system for documentation. 9 // See http://www.boost.org/libs/system for documentation.
41 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING 42 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
42 static BOOST_CHRONO_INLINE time_point now(system::error_code & ec ); 43 static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
43 #endif 44 #endif
44 }; 45 };
45 46
47 #if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
46 class BOOST_CHRONO_DECL process_user_cpu_clock { 48 class BOOST_CHRONO_DECL process_user_cpu_clock {
47 public: 49 public:
48 typedef nanoseconds duration; 50 typedef nanoseconds duration;
49 typedef duration::rep rep; 51 typedef duration::rep rep;
50 typedef duration::period period; 52 typedef duration::period period;
68 static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT; 70 static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
69 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING 71 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
70 static BOOST_CHRONO_INLINE time_point now(system::error_code & ec ); 72 static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
71 #endif 73 #endif
72 }; 74 };
75 #endif
73 76
74 template <typename Rep> 77 template <typename Rep>
75 struct process_times 78 struct process_times
76 : arithmetic<process_times<Rep>, 79 : arithmetic<process_times<Rep>,
77 multiplicative<process_times<Rep>, Rep, 80 multiplicative<process_times<Rep>, Rep,
81 typedef Rep rep; 84 typedef Rep rep;
82 process_times() 85 process_times()
83 : real(0) 86 : real(0)
84 , user(0) 87 , user(0)
85 , system(0){} 88 , system(0){}
89
90 #if ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
86 template <typename Rep2> 91 template <typename Rep2>
87 explicit process_times( 92 explicit process_times(
88 Rep2 r) 93 Rep2 r)
89 : real(r) 94 : real(r)
90 , user(r) 95 , user(r)
91 , system(r){} 96 , system(r){}
97 #endif
92 template <typename Rep2> 98 template <typename Rep2>
93 explicit process_times( 99 explicit process_times(
94 process_times<Rep2> const& rhs) 100 process_times<Rep2> const& rhs)
95 : real(rhs.real) 101 : real(rhs.real)
96 , user(rhs.user) 102 , user(rhs.user)
105 111
106 rep real; // real (i.e wall clock) time 112 rep real; // real (i.e wall clock) time
107 rep user; // user cpu time 113 rep user; // user cpu time
108 rep system; // system cpu time 114 rep system; // system cpu time
109 115
116 #if ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
110 operator rep() const 117 operator rep() const
111 { 118 {
112 return real; 119 return real;
113 } 120 }
121 #endif
114 template <typename Rep2> 122 template <typename Rep2>
115 bool operator==(process_times<Rep2> const& rhs) { 123 bool operator==(process_times<Rep2> const& rhs) {
116 return (real==rhs.real && 124 return (real==rhs.real &&
117 user==rhs.user && 125 user==rhs.user &&
118 system==rhs.system); 126 system==rhs.system);
178 { 186 {
179 os << "{"<< real <<";"<< user <<";"<< system << "}"; 187 os << "{"<< real <<";"<< user <<";"<< system << "}";
180 } 188 }
181 189
182 template <class CharT, class Traits> 190 template <class CharT, class Traits>
183 void read(std::basic_istream<CharT, Traits>& is) const 191 void read(std::basic_istream<CharT, Traits>& is)
184 { 192 {
185 typedef std::istreambuf_iterator<CharT, Traits> in_iterator; 193 typedef std::istreambuf_iterator<CharT, Traits> in_iterator;
186 in_iterator i(is); 194 in_iterator i(is);
187 in_iterator e; 195 in_iterator e;
188 if (i == e || *i != '{') // mandatory '{' 196 if (i == e || *i != '{') // mandatory '{'
290 duration<Rep1, Period1>, duration<Rep2, Period2> >()(lhs, rhs); 298 duration<Rep1, Period1>, duration<Rep2, Period2> >()(lhs, rhs);
291 } 299 }
292 300
293 301
294 typedef process_times<nanoseconds::rep> process_cpu_clock_times; 302 typedef process_times<nanoseconds::rep> process_cpu_clock_times;
303 #if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
295 class BOOST_CHRONO_DECL process_cpu_clock 304 class BOOST_CHRONO_DECL process_cpu_clock
296 { 305 {
297 public: 306 public:
298 307
299 typedef process_cpu_clock_times times; 308 typedef process_cpu_clock_times times;
306 static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT; 315 static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
307 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING 316 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
308 static BOOST_CHRONO_INLINE time_point now(system::error_code & ec ); 317 static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
309 #endif 318 #endif
310 }; 319 };
320 #endif
311 321
312 template <class CharT, class Traits, typename Rep> 322 template <class CharT, class Traits, typename Rep>
313 std::basic_ostream<CharT, Traits>& 323 std::basic_ostream<CharT, Traits>&
314 operator<<(std::basic_ostream<CharT, Traits>& os, 324 operator<<(std::basic_ostream<CharT, Traits>& os,
315 process_times<Rep> const& rhs) 325 process_times<Rep> const& rhs)
319 } 329 }
320 330
321 template <class CharT, class Traits, typename Rep> 331 template <class CharT, class Traits, typename Rep>
322 std::basic_istream<CharT, Traits>& 332 std::basic_istream<CharT, Traits>&
323 operator>>(std::basic_istream<CharT, Traits>& is, 333 operator>>(std::basic_istream<CharT, Traits>& is,
324 process_times<Rep> const& rhs) 334 process_times<Rep>& rhs)
325 { 335 {
326 rhs.read(is); 336 rhs.read(is);
327 return is; 337 return is;
328 } 338 }
329 339
370 const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0])); 380 const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
371 return str; 381 return str;
372 } 382 }
373 }; 383 };
374 384
385 #if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
375 template<class CharT> 386 template<class CharT>
376 struct clock_string<process_user_cpu_clock, CharT> 387 struct clock_string<process_user_cpu_clock, CharT>
377 { 388 {
378 static std::basic_string<CharT> name() 389 static std::basic_string<CharT> name()
379 { 390 {
434 { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' }; 445 { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
435 const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0])); 446 const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
436 return str; 447 return str;
437 } 448 }
438 }; 449 };
450 #endif
439 451
440 } // namespace chrono 452 } // namespace chrono
441 } // namespace boost 453 } // namespace boost
442 454
443 namespace std { 455 namespace std {