Boost logo

Boost-Build :

Subject: Re: [Boost-build] measuring command time in bjam
From: Stefan Seefeld (stefan_at_[hidden])
Date: 2017-11-07 14:08:44


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...
    



signature.png

Boost-Build 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