Expose the __rdtsc
CPU cycle counter to user-land using a php extension
- x64 platform
- gcc
phpize
./configure
make
php -d extension=modules/rdtsc.so example.php
Given the various caveats with __rdtsc
this should be used with great care when trying to measure things.
There also is a PHP-FFI implementation that provides the same functionality available.
For most cases getrusage()
should be preferable.