[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44674: 28.0.50; Adding current-cpu-time for performance tests
From: |
Philipp Stephani |
Subject: |
bug#44674: 28.0.50; Adding current-cpu-time for performance tests |
Date: |
Mon, 16 Nov 2020 08:13:32 +0100 |
Am Mo., 16. Nov. 2020 um 02:08 Uhr schrieb Stefan Monnier
<monnier@iro.umontreal.ca>:
> +#ifdef CLOCKS_PER_SEC
> +DEFUN ("current-cpu-time", Fcurrent_cpu_time, Scurrent_cpu_time, 0, 0, 0,
> + doc: /* Return the current CPU time along with its resolution.
> +The return value is a pair (CPU-TICKS . TICKS-PER-SEC).
> +The CPU-TICKS counter can wrap around, so values cannot be meaningfully
> +compared if too much time has passed between them. */)
> + (void)
> +{
> + return Fcons (make_int (clock ()), make_int (CLOCKS_PER_SEC));
> +}
> +#endif
Looks useful!
It might be beneficial to use the higher-resolution clock_gettime with
CLOCK_PROCESS_CPUTIME_ID if available and only fall back to clock()
otherwise.
While there, consider also implementing a function to read the
CLOCK_MONOTONIC clock – that should be preferred over the realtime
clock for stopwatch-style measurements.
- bug#44674: 28.0.50; Adding current-cpu-time for performance tests, Stefan Monnier, 2020/11/15
- bug#44674: 28.0.50; Adding current-cpu-time for performance tests,
Philipp Stephani <=
- bug#44674: 28.0.50; Adding current-cpu-time for performance tests, Eli Zaretskii, 2020/11/16
- bug#44674: 28.0.50; Adding current-cpu-time for performance tests, Eli Zaretskii, 2020/11/16
- bug#44674: 28.0.50; Adding current-cpu-time for performance tests, Philipp Stephani, 2020/11/16
- bug#44674: 28.0.50; Adding current-cpu-time for performance tests, Eli Zaretskii, 2020/11/16
- bug#44674: 28.0.50; Adding current-cpu-time for performance tests, Philipp Stephani, 2020/11/16
- bug#44674: 28.0.50; Adding current-cpu-time for performance tests, Eli Zaretskii, 2020/11/16
- bug#44674: 28.0.50; Adding current-cpu-time for performance tests, Lars Ingebrigtsen, 2020/11/16
bug#44674: 28.0.50; Adding current-cpu-time for performance tests, Mattias Engdegård, 2020/11/16