GNU bug report logs -
#44674
28.0.50; Adding current-cpu-time for performance tests
Previous Next
Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date: Mon, 16 Nov 2020 01:08:01 UTC
Severity: wishlist
Tags: moreinfo
Found in version 28.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #98 received at 44674 <at> debbugs.gnu.org (full text, mbox):
>> > > AFAIU, using 'clock' here is not the best idea, as there are caveats wrt to
>> > > calling 'system', and the origin of the returned value is not well defined
>> > > to be portable.
>> >
>> > What do you mean by "origin" and by "calling 'system'"?
>>
>> Quoting https://pubs.opengroup.org/onlinepubs/9699919799/:
>>
>> The clock() function shall return the implementation's best
>> approximation to the processor time used by the process
>> since the beginning of an implementation-defined era
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> related only to the process invocation.
>>
>> How do you write portable Lisp code that returns consistent results
>> based on such shaky foundations?
>
> For non-walltime clocks, only the difference between two measurements
> is meaningful.
Mabe the API we should expose should give access to the actual time but
only to time-differences, as in:
(funcall-with-cpu-time FUNCTION)
Call FUNCTION and return the CPU time used.
The return value is of the form (TIME . VALUE) where TIME is the CPU
time used during execution of FUNCTION, measured in seconds, and
VALUE is the return value of FUNCTION.
-- Stefan
This bug report was last modified 3 years and 107 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.