Skip to content

Expose the CPU cycle counter via `\rdtsc()` to user-land using PHP-FFI

License

Notifications You must be signed in to change notification settings

edorian/php-ffi-rdtsc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-ffi-rdtsc

Expose the __rdtsc CPU cycle counter to user-land using PHP-FFI

Requirements

  • x64 platform
  • gcc
  • php-ffi
  • ffi.enable=true or alternatively ffi.enable=preload for the CLI SAPI

Usage

./compile.sh
php example.php

Notes

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.

References

About

Expose the CPU cycle counter via `\rdtsc()` to user-land using PHP-FFI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published