[fpc-pascal] Very vague gettickcount64 description?
Michael Van Canneyt
michael at freepascal.org
Sun Sep 8 12:42:44 CEST 2019
On Sun, 8 Sep 2019, Yuriy Sydorov wrote:
> On 08.09.2019 10:09, Michael Van Canneyt wrote:
>> On Sat, 7 Sep 2019, Zoe Peterson wrote:
>>>> From: Martin Frb <lazarus at mfriebe.de>
>>>> But that does not mean, it needs to be changed on existing targets.
>>>> And if it is not going to be changed, then it can be documented.
>>> I agree with everything Martin has said, though IMO GetTickCount must
> return values in ms on every single platform and
>>> any that can't should have it removed. It's not a precision timer and it
> should not be an intrinsic for whatever
>>> random RDTSC-like instruction the current platform has. It's used for
> checking (rough) elapsed times. I honestly can't
>>> think of a single use for the current function as defined, especially in a
> cross-platform app. Precision and accuracy
>>> can vary, but unspecified units with no way to query them is ridiculous.
>> For relative measurements, units are not needed. A ratio has no units, the
>> only thing that is required is that the units for both measurements are the
>> same (which should be the case on a single platform).
> Strictly defined measurement units are important for cross-platform (and
> Delphi) compatibility. So GetTickCount_2 -
> GetTickCount_1 must return how many milliseconds have elapsed between calls
> of GetTickCount regardless of the platform
> where the program is running.
I understand, but I remain with my point of view that this is a worthless measurement
if you simply do gettick; operation; gettick;
Since gettick itself takes time (definitely the fallback to fpgettimeofday)
the measurement itself influences the resulting time (a bit like quantum theory).
So for small times, I would distrust anything measured like that.
For good measurements, you need to repeat the operation say 100x or 1000x
and average out. And then you can just use now().
More information about the fpc-pascal