Need higher resolution times for linpack benchmark

Andi Kleen andi@firstfloor.org
Mon Dec 14 13:41:00 GMT 2009


Janne Blomqvist <blomqvist.janne@gmail.com> writes:

> On Sat, Dec 12, 2009 at 02:19, Tobias Burnus <burnus@net-b.de> wrote:
>> In principle, SYSTEM_CLOCK would, if count_rate is/were large enough,
>> cf. http://gcc.gnu.org/onlinedocs/gfortran/SYSTEM_005fCLOCK.html
>>
>> Internally, it uses POSIX's clock_gettime (when available), which in
>> principle provides sub-ms resolution.
>
> Actually, it doesn't. It prefers to use gettimeofday() which provides
> 1 us resolution, falling back to time() with 1s resolution. In
> practice, I believe gettimeofday() is available more or less
> everywhere. With clock_gettime() we could get in principle up to 1 ns
> resolution (With Linux 2.6.31 I got around 60 -> 800 ns depending in
> which timer I used), however the downside of that is that it's not as
> ubiquitous and if it exists it lives in librt or libposix depending on
> platform, so we'd need some configure magic to handle that and link in
> those libraries.

The problem with gettimeofday() is that it may go slower/faster when
NTP is active and adjusting time drift. If you want a constantly
ticking clock better use CLOCK_MONOTONIC.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.



More information about the Fortran mailing list