High resolution timer function
| From: | Anatol Belski | Date: | Sat, 16 Dec 2017 14:03:25 +0000 |
| Subject: | High resolution timer function | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-101358@lists.php.net to get a copy of this message | ||
Hi,
I would like to propose a function for high resolution monotonic timing. There was discussions about
this before and a PR https://github.com/php/php-src/pull/2368 which
has issues and was abandoned. I've filed https://github.com/php/php-src/pull/2976 with
some reworked implementation.
A monotonic timer can be usable in several situations besides benchmarking. Having a simple
functionality like this in the core should be a useful addition. The current approach is a function
returning array of [seconds, nanoseconds] and optionally returning full nanosecond number as int on
64-bit or float on 32-bit. The first way is the most portable. Quite a few platforms are already
supported by the current implementation.
IMHO it should be fine to have a function like this in the core, perhaps also a few helper functions
could be useful, too. I would like to pursue 7.3 with this. Please lets check for any concerns in
general or with implementation, naming, etc.
Regards
Anatol