Re: [fpc-pascal] Sub-millisecond time measuring

2024-06-29 Thread Adriaan van Os via fpc-pascal
Michael Van Canneyt via fpc-pascal wrote: 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). g_get_monotonic_time is in glib

Re: [fpc-pascal] Sub-millisecond time measuring

2024-06-29 Thread Graeme Geldenhuys via fpc-pascal
On 28/06/2024 14:31, Hairy Pixels via fpc-pascal wrote: > Thanks I'll check that out. I'm not using Lazarus so tons of dependencies > won't work It's a Lazarus package (for convenience), but it doesn't depend on the LCL. You can use it with pure FPC programs, or even without the Lazarus package f

Re: [fpc-pascal] Sub-millisecond time measuring

2024-06-29 Thread Graeme Geldenhuys via fpc-pascal
On 28/06/2024 22:50, Hairy Pixels via fpc-pascal wrote: > But that's still millisecond precision. On Windows, Linux and FreeBSD it uses nanosecond precision. Unfortunately on MacOS, it falls back to RTL's GetTickCount64(), which as you mentioned, is millisecond precision. It shouldn't be hard to a

Re: [fpc-pascal] Sub-millisecond time measuring

2024-06-29 Thread Michael Van Canneyt via fpc-pascal
On Sat, 29 Jun 2024, Hairy Pixels via fpc-pascal wrote: On Jun 29, 2024, at 5:43 PM, Adriaan van Os 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 accumulat

Re: [fpc-pascal] Sub-millisecond time measuring

2024-06-29 Thread Hairy Pixels via fpc-pascal
> On Jun 29, 2024, at 5:43 PM, Adriaan van Os 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 be

Re: [fpc-pascal] Sub-millisecond time measuring

2024-06-29 Thread Adriaan van Os via fpc-pascal
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