view 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
line wrap: on
line source

Description:
A simple self-profiling module based on timers.

Files:
lib/timevar.h
lib/timevar.c

Depends-on:
gethrxtime
getrusage
gettext-h
stdlib
sys_time
sys_times
xalloc

Makefile.am:
lib_SOURCES += timevar.c timevar.def

Include:
"timevar.h"

Link:
$(LIB_GETHRXTIME)
$(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise

License:
GPLv3+

Maintainer:
Akim Demaille <akim.demaille@gmail.com>