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

2024-07-02 Thread Rafael Picanço via fpc-pascal
Hi everyone. I am sharing some cross-platform timing I have done, it would be great to hear from you. For mac I translated this python implementation to free pascal: https://github.com/pupil-labs/pyuvc/blob/master/pyuvc-source/darwin_time.pxi ): ``` unit

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

2024-07-01 Thread Adriaan van Os via fpc-pascal
Sven Barth via fpc-pascal wrote: I wouldn't introduce a dependency for something like GTK (especially GTK!) on macOS only to receive some timings. Simpler and more straight forward to just use the correct functions of the OS. Of course not, Unless you are doing some cross-development,

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

2024-07-01 Thread Michael Van Canneyt via fpc-pascal
On Mon, 1 Jul 2024, Sven Barth via fpc-pascal wrote: Adriaan van Os via fpc-pascal schrieb am Sa., 29. Juni 2024, 21:21: 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

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

2024-07-01 Thread Sven Barth via fpc-pascal
Adriaan van Os via fpc-pascal schrieb am Sa., 29. Juni 2024, 21:21: > 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 > >

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

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

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

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

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

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

2024-06-28 Thread Hairy Pixels via fpc-pascal
> On Jun 28, 2024, at 10:44 PM, Christo Crause wrote: > > It is based on TComponent from the RTL classes unit, so no dependency on LCL > or other Lazarus units. A quick check of the source code suggests that it > will probably call GetTickCount64 >

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

2024-06-28 Thread Christo Crause via fpc-pascal
On Fri, Jun 28, 2024 at 5:31 PM Hairy Pixels via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Thanks I'll check that out. I'm not using Lazarus so tons of dependencies > won't work but maybe I can learn something. I'm on macOS too so if this is > using system calls it may not be

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

2024-06-28 Thread Hairy Pixels via fpc-pascal
Thanks I'll check that out. I'm not using Lazarus so tons of dependencies won't work but maybe I can learn something. I'm on macOS too so if this is using system calls it may not be supported. > On Jun 28, 2024, at 10:10 PM, Christo Crause wrote: > > > On Fri, Jun 28, 2024 at 2:34 PM Hairy

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

2024-06-28 Thread Christo Crause via fpc-pascal
On Fri, Jun 28, 2024 at 2:34 PM Hairy Pixels via fpc-pascal < fpc-pascal@lists.freepascal.org> 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

[fpc-pascal] Sub-millisecond time measuring

2024-06-28 Thread Hairy Pixels via fpc-pascal
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