[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
https://www.gnu.org/software/gnulib/manual/html_node/clock_005fgettime.html
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
macros.
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').
Bruno
- Re: timevar: further work, (continued)
- Re: timevar: further work, Bruno Haible, 2018/10/11
- Re: timevar: further work, Akim Demaille, 2018/10/11
- Re: timevar: further work, Akim Demaille, 2018/10/11
- Re: timevar: 1/3: expect that getrusage is available, Akim Demaille, 2018/10/12
- Re: timevar: 1/3: expect that getrusage is available, Bruno Haible, 2018/10/12
- Re: timevar: 1/3: expect that getrusage is available, Akim Demaille, 2018/10/13
- Re: timevar: 1/3: expect that getrusage is available, Bruno Haible, 2018/10/13
- Re: timevar: 2/3: improve the output format, Akim Demaille, 2018/10/12
- Re: timevar: 2/3: improve the output format, Bruno Haible, 2018/10/12
- Re: timevar: 3/3: use clock_gettime to get wall clock time, Akim Demaille, 2018/10/12
- Re: timevar: 3/3: use clock_gettime to get wall clock time,
Bruno Haible <=
- Re: timevar: 3/3: use clock_gettime to get wall clock time, Akim Demaille, 2018/10/13
- Re: timevar: 3/3: use clock_gettime to get wall clock time, Bruno Haible, 2018/10/13
- Re: timevar: 3/3: use clock_gettime to get wall clock time, Akim Demaille, 2018/10/13
- Re: timevar: 3/3: use clock_gettime to get wall clock time, Bruno Haible, 2018/10/13
- Re: timevar: 3/3: use clock_gettime to get wall clock time, Akim Demaille, 2018/10/13
- Re: timevar: 3/3: use clock_gettime to get wall clock time, Bruno Haible, 2018/10/13
- Re: timevar: 3/3: use clock_gettime to get wall clock time, Akim Demaille, 2018/10/14
- Re: timevar: 3/3: use clock_gettime to get wall clock time, Bruno Haible, 2018/10/14
- Re: timevar: 3/3: use clock_gettime to get wall clock time, Akim Demaille, 2018/10/14
- Re: timevar: 3/3: use clock_gettime to get wall clock time, Bruno Haible, 2018/10/14