measuring command time in bjam

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

measuring command time in bjam

Boost - Build mailing list

Hi Steven,

I just notice that bjam measures time (via `timestamp_current()`) on non-Windows systems by simply calling `time()`, rather than something more precise such as `gettimeofday()`. Do you know why ?


Thanks,

Stefan
-- 

      ...ich hab' noch einen Koffer in Berlin...
    

_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: measuring command time in bjam

Boost - Build mailing list
AMDG

On 11/06/2017 03:03 PM, Stefan Seefeld via Boost-build wrote:
> I just notice that bjam measures time (via `timestamp_current()`) on non-Windows
> systems by simply calling `time()`, rather than something more precise such as
> `gettimeofday()`. Do you know why ?
>

  Historical reasons, probably.  timestamp_current needs to be
be consistent with the code that reads the file timestamps,
which uses struct stat.m_time (which is a time_t).  The code
was updated to get higher resolution on Windows, but not for
others.

In Christ,
Steven Watanabe

_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: measuring command time in bjam

Boost - Build mailing list
On 06.11.2017 17:21, Steven Watanabe via Boost-build wrote:
AMDG

On 11/06/2017 03:03 PM, Stefan Seefeld via Boost-build wrote:
I just notice that bjam measures time (via `timestamp_current()`) on non-Windows 
systems by simply calling `time()`, rather than something more precise such as 
`gettimeofday()`. Do you know why ?

  Historical reasons, probably.  timestamp_current needs to be
be consistent with the code that reads the file timestamps,
which uses struct stat.m_time (which is a time_t).  The code
was updated to get higher resolution on Windows, but not for
others.

OK. I have switched to gettimeofday() in my fork, which makes timing command performance much more meaningful. Looking into this I also noticed a bug in the `timestamp_delta_seconds()` implementation (https://github.com/boostorg/build/blob/develop/src/engine/timestamp.c#L270): The factor should be 1e9 rather than 1e6 (it's nanoseconds, not microseconds that get added to seconds).

Regards,

Stefan
-- 

      ...ich hab' noch einen Koffer in Berlin...
    

_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build