Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75920 - trunk/boost/chrono/detail/inlined/posix
From: vicente.botet_at_[hidden]
Date: 2011-12-12 13:00:25


Author: viboes
Date: 2011-12-12 13:00:24 EST (Mon, 12 Dec 2011)
New Revision: 75920
URL: http://svn.boost.org/trac/boost/changeset/75920

Log:
Chrono: process_cpu_clock::now() on linux gives time_points 1/1000 times
Text files modified:
   trunk/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp | 66 ++++++++++++++++++++--------------------
   1 files changed, 33 insertions(+), 33 deletions(-)

Modified: trunk/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp (original)
+++ trunk/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp 2011-12-12 13:00:24 EST (Mon, 12 Dec 2011)
@@ -32,8 +32,8 @@
         factor = -1;
       else
       {
- BOOST_ASSERT( factor <= 1000000l ); // doesn't handle large ticks
- factor = 1000000l / factor; // compute factor
+ BOOST_ASSERT( factor <= 1000000000l ); // doesn't handle large ticks
+ factor = 1000000000l / factor; // compute factor
         if ( !factor ) factor = -1;
       }
     }
@@ -54,7 +54,7 @@
         if ( chrono_detail::tick_factor() != -1 )
         {
             return time_point(
- microseconds(c*chrono_detail::tick_factor()));
+ nanoseconds(c*chrono_detail::tick_factor()));
         }
         else
         {
@@ -66,9 +66,9 @@
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 process_real_cpu_clock::time_point process_real_cpu_clock::now(
- system::error_code & ec)
+ system::error_code & ec)
 {
-
+
     tms tm;
     clock_t c = ::times( &tm );
     if ( c == clock_t(-1) ) // error
@@ -76,9 +76,9 @@
         if (BOOST_CHRONO_IS_THROWS(ec))
         {
             boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ errno,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
                             "chrono::process_real_cpu_clock" ));
         }
         else
@@ -91,21 +91,21 @@
     {
         if ( chrono_detail::tick_factor() != -1 )
         {
- if (!BOOST_CHRONO_IS_THROWS(ec))
+ if (!BOOST_CHRONO_IS_THROWS(ec))
             {
                 ec.clear();
             }
             return time_point(
- microseconds(c*chrono_detail::tick_factor()));
+ nanoseconds(c*chrono_detail::tick_factor()));
         }
         else
         {
             if (BOOST_CHRONO_IS_THROWS(ec))
             {
                 boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ errno,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
                                 "chrono::process_real_cpu_clock" ));
             }
             else
@@ -131,7 +131,7 @@
         if ( chrono_detail::tick_factor() != -1 )
         {
             return time_point(
- microseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor()));
+ nanoseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor()));
         }
         else
         {
@@ -152,9 +152,9 @@
         if (BOOST_CHRONO_IS_THROWS(ec))
         {
             boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ errno,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
                             "chrono::process_user_cpu_clock" ));
         }
         else
@@ -167,21 +167,21 @@
     {
         if ( chrono_detail::tick_factor() != -1 )
         {
- if (!BOOST_CHRONO_IS_THROWS(ec))
+ if (!BOOST_CHRONO_IS_THROWS(ec))
             {
                 ec.clear();
             }
             return time_point(
- microseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor()));
+ nanoseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor()));
         }
         else
         {
             if (BOOST_CHRONO_IS_THROWS(ec))
             {
                 boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ errno,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
                                 "chrono::process_user_cpu_clock" ));
             }
             else
@@ -208,7 +208,7 @@
         if ( chrono_detail::tick_factor() != -1 )
         {
             return time_point(
- microseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor()));
+ nanoseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor()));
         }
         else
         {
@@ -248,7 +248,7 @@
                 ec.clear();
             }
             return time_point(
- microseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor()));
+ nanoseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor()));
         }
         else
         {
@@ -297,8 +297,8 @@
 }
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
-process_cpu_clock::time_point process_cpu_clock::now(
- system::error_code & ec )
+process_cpu_clock::time_point process_cpu_clock::now(
+ system::error_code & ec )
 {
     tms tm;
     clock_t c = ::times( &tm );
@@ -307,9 +307,9 @@
         if (BOOST_CHRONO_IS_THROWS(ec))
         {
             boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ errno,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
                             "chrono::process_clock" ));
         }
         else
@@ -333,9 +333,9 @@
             if (BOOST_CHRONO_IS_THROWS(ec))
             {
                 boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ errno,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
                                 "chrono::process_clock" ));
             }
             else
@@ -345,7 +345,7 @@
             }
         }
     }
-
+
 }
 #endif
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk