diff options
| author | Paul Eggert | 2012-07-10 16:24:36 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-10 16:24:36 -0700 |
| commit | e9a9ae0350689d352c2bdfa3af0eb722f587b966 (patch) | |
| tree | 10ed0298079b06838a525f0a4df780d7600e13fe /src/alloc.c | |
| parent | ffacb12679a1e001981c2e0f690b327eda652d04 (diff) | |
| download | emacs-e9a9ae0350689d352c2bdfa3af0eb722f587b966.tar.gz emacs-e9a9ae0350689d352c2bdfa3af0eb722f587b966.zip | |
EMACS_TIME simplification (Bug#11875).
This replaces macros (which typically do not work in GDB)
with functions, typedefs and enums, making the code easier to debug.
The functional style also makes code easier to read and maintain.
* lib-src/profile.c (TV2): Remove no-longer-needed static var.
* src/systime.h: Include <sys/time.h> on all hosts, not just if
WINDOWSNT, since 'struct timeval' is needed in general.
(EMACS_TIME): Now a typedef, not a macro.
(EMACS_TIME_RESOLUTION, LOG10_EMACS_TIME_RESOLUTION): Now constants,
not macros.
(EMACS_SECS, EMACS_NSECS, EMACS_TIME_SIGN, EMACS_TIME_VALID_P)
(EMACS_TIME_FROM_DOUBLE, EMACS_TIME_TO_DOUBLE, EMACS_TIME_EQ)
(EMACS_TIME_NE, EMACS_TIME_GT, EMACS_TIME_GE, EMACS_TIME_LT)
(EMACS_TIME_LE): Now functions, not macros.
(EMACS_SET_SECS, EMACS_SET_NSECS, EMACS_SET_SECS_NSECS)
(EMACS_SET_USECS, EMACS_SET_SECS_USECS): Remove these macros,
which are not functions. All uses rewritten to use:
(make_emacs_time): New function.
(EMACS_SECS_ADDR, EMACS_SET_INVALID_TIME, EMACS_GET_TIME)
(EMACS_ADD_TIME, EMACS_SUB_TIME): Remove these macros, which are
not functions. All uses rewritten to use the following, respectively:
(emacs_secs_addr, invalid_emacs_time, get_emacs_time)
(add_emacs_time, sub_emacs_time): New functions.
* src/atimer.c: Don't include <sys/time.h>, as "systime.h" does this.
* src/fileio.c (Fcopy_file):
* src/xterm.c (XTflash): Get the current time closer to when it's used.
* src/makefile.w32-in ($(BLD)/atimer.$(O)): Update dependencies.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/alloc.c b/src/alloc.c index 52d683a1b67..89f2c5dbed1 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -5393,7 +5393,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5393 | int message_p; | 5393 | int message_p; |
| 5394 | Lisp_Object total[8]; | 5394 | Lisp_Object total[8]; |
| 5395 | ptrdiff_t count = SPECPDL_INDEX (); | 5395 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5396 | EMACS_TIME t1, t2, t3; | 5396 | EMACS_TIME t1; |
| 5397 | 5397 | ||
| 5398 | if (abort_on_gc) | 5398 | if (abort_on_gc) |
| 5399 | abort (); | 5399 | abort (); |
| @@ -5442,7 +5442,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5442 | } | 5442 | } |
| 5443 | } | 5443 | } |
| 5444 | 5444 | ||
| 5445 | EMACS_GET_TIME (t1); | 5445 | t1 = current_emacs_time (); |
| 5446 | 5446 | ||
| 5447 | /* In case user calls debug_print during GC, | 5447 | /* In case user calls debug_print during GC, |
| 5448 | don't let that cause a recursive GC. */ | 5448 | don't let that cause a recursive GC. */ |
| @@ -5696,8 +5696,8 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5696 | /* Accumulate statistics. */ | 5696 | /* Accumulate statistics. */ |
| 5697 | if (FLOATP (Vgc_elapsed)) | 5697 | if (FLOATP (Vgc_elapsed)) |
| 5698 | { | 5698 | { |
| 5699 | EMACS_GET_TIME (t2); | 5699 | EMACS_TIME t2 = current_emacs_time (); |
| 5700 | EMACS_SUB_TIME (t3, t2, t1); | 5700 | EMACS_TIME t3 = sub_emacs_time (t2, t1); |
| 5701 | Vgc_elapsed = make_float (XFLOAT_DATA (Vgc_elapsed) | 5701 | Vgc_elapsed = make_float (XFLOAT_DATA (Vgc_elapsed) |
| 5702 | + EMACS_TIME_TO_DOUBLE (t3)); | 5702 | + EMACS_TIME_TO_DOUBLE (t3)); |
| 5703 | } | 5703 | } |