Mercurial > gnulib
comparison modules/timevar @ 39916:dbcdcd1db895
timevar: use gethrxtime to get wall clock time
clock_gettime is not portable. gethrxtime takes the best available
option to get the wall clock time, including clock_gettime (monotonic
clock), and gettime (non monotonic).
Also, using xtime_t instead of float preserves the precision.
Suggested by Bruno Haible.
* lib/xtime.h (xtime_make): Handle overflows of nanoseconds.
* modules/timevar (Depends-on): We need gethrxtime.
We no longer use times().
(Link): Update.
* lib/timevar.h (timevar_time_def): Use xtime_t.
* lib/timevar.c (set_to_current_time): Use gethrxtime.
(timevar_print): Instead of checking whether the timings themselves
are large enough for the timevar to be printed, check the percentages.
author | Akim Demaille <akim.demaille@gmail.com> |
---|---|
date | Fri, 12 Oct 2018 06:46:09 +0200 |
parents | 24499928832b |
children | 8cd851acf6a6 |
comparison
equal
deleted
inserted
replaced
39915:6ad3d081a5ab | 39916:dbcdcd1db895 |
---|---|
4 Files: | 4 Files: |
5 lib/timevar.h | 5 lib/timevar.h |
6 lib/timevar.c | 6 lib/timevar.c |
7 | 7 |
8 Depends-on: | 8 Depends-on: |
9 gethrxtime | |
9 getrusage | 10 getrusage |
10 gettext-h | 11 gettext-h |
11 stdlib | 12 stdlib |
12 sys_time | 13 sys_time |
13 sys_times | 14 sys_times |
14 times | |
15 xalloc | 15 xalloc |
16 | 16 |
17 Makefile.am: | 17 Makefile.am: |
18 lib_SOURCES += timevar.c timevar.def | 18 lib_SOURCES += timevar.c timevar.def |
19 | 19 |
20 Include: | 20 Include: |
21 "timevar.h" | 21 "timevar.h" |
22 | 22 |
23 Link: | |
24 $(LIB_GETHRXTIME) | |
25 $(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise | |
26 | |
23 License: | 27 License: |
24 GPLv3+ | 28 GPLv3+ |
25 | 29 |
26 Maintainer: | 30 Maintainer: |
27 Akim Demaille <akim.demaille@gmail.com> | 31 Akim Demaille <akim.demaille@gmail.com> |