Expose the __rdtsc
CPU cycle counter to user-land using PHP-FFI
- x64 platform
- gcc
- php-ffi
ffi.enable=true
or alternativelyffi.enable=preload
for the CLI SAPI
./compile.sh
php 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 extension that provides the same functionality available.
For most cases getrusage()
should be preferable.