[fpc-pascal] Sub-millisecond time measuring
Michael Van Canneyt
michael at freepascal.org
Sat Jun 29 15:00:06 CEST 2024
On Sat, 29 Jun 2024, Hairy Pixels via fpc-pascal wrote:
>
>
>> On Jun 29, 2024, at 5:43 PM, Adriaan van Os <adriaan at adriaan.biz> wrote:
>>
>> Hairy Pixels via fpc-pascal wrote:
>>> I had a large function which I was profiling with MilliSecondsBetween but I split it to be called many different times and now it's not accumulating the total time correctly because time is being lost to due millisecond precision.
>>> Is there anything in the RTL I can use which is more accurate? I searched and couldn't find anything.
>>
>> You can use Microseconds on MacOS, QueryPerformanceFrequency on Windows and g_get_monotonic_time with gtk on Linux.
>>
>> Regards,
>>
>> Adriaan van Os
>>
>
> Is that a function in the RTL? I can't find it.
No, these are platform-specific functions.
g_get_monotonic_time is probably just an alias for the linux/freebsd unit functions
clock_gettime(CLOCK_MONOTONIC_RAW).
QueryPerformanceFrequency you will probably find in the Windows unit.
Microseconds can be found in the Timer unit (part of univint package)
Michael.
More information about the fpc-pascal
mailing list