[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: timevar: 3/3: use clock_gettime to get wall clock time

From: Bruno Haible
Subject: Re: timevar: 3/3: use clock_gettime to get wall clock time
Date: Fri, 12 Oct 2018 17:59:01 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-137-generic; KDE/5.18.0; x86_64; ; )

Hi Akim,

There are three issues with this patch:

1) Portability. As listed in
Gnulib provides no replacement for clock_gettime. So, you'll probably need
gettimeofday or module 'gettime' as fallback.

For clock_gettime, you can use the Gnulib module 'clock-time' for the m4

2) Precision. When you use gettimeofday, the starting point is 1970, thus
the number of microseconds stored in the 'wall' field will be around
1.6e15, thus when stored as 'float' the precision will be in the range of
3 to 10 minutes. A program which runs for less than a minute will have
wall clock difference of 0 with high probability.
=> The 'wall' field should better be a 'double'.

Or possibly solve both problems at once by using the Gnulib module
'gethrxtime', and 'xtime_t' instead of 'float' for the 'wall' field.
Or 'gettime'. I don't know how 'gettime' compares against 'gethrxtime'.

3) Link dependency: List the link dependencies, like it's done e.g. in
the 'clock-time', 'gettime', and 'gethrxtime' modules. Also use these
dependencies when linking the test program (in module 'timevar-tests').


reply via email to

[Prev in Thread] Current Thread [Next in Thread]