stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

Timer support

Open awvwgk opened this issue 4 years ago • 4 comments

Support for measuring timings, having timer ranges and pretty printing of time printout would be a useful addition. This is especially helpful for comparing implementation without relying on external tools.

awvwgk avatar Dec 20 '21 21:12 awvwgk

Some time ago I prototyped some fypp macros for benchmarking. Not sure if they really offer any advantage vs subroutines/functions, but I think I was trying to emulate what Julia has. If I recall correctly Julia timer macros will adjust the number of calls automatically to obtain a decent sample, and then calculate some basic statistics (mean, variance).

A few more links to other timer packages can be found here: https://github.com/fortran-lang/benchmarks/issues/6 The most complete one I've seen is the NIST StopWatch package but it would need a modern update.

On the other hand something more minimalistic could also be useful.

ivan-pi avatar Dec 20 '21 23:12 ivan-pi

Another timer implementation here.

nncarlson avatar Dec 21 '21 20:12 nncarlson

https://github.com/urbanjost/M_stopwatch is a version of StopWatch as an fpm package as well; albeit I use vendor utilities or gprof(1) myself for optimizing, sometimes I want an embedded timer. I found the dynamic loader module particularly interesting at the previously mentioned site; those are nicely done and look like they would be nice additions to the fpm(1) registry. At a minimum those should be added to the Fortran Wiki site.

urbanjost avatar Dec 21 '21 22:12 urbanjost

I might be missing something, but does the System_Clock() internal not already support this basic functionality?

trippalamb avatar Apr 07 '22 18:04 trippalamb