Use it in place of
:alpine-official when you want profiling.
Add the following when you want to start profiling your code:
xhprof_enable(XHPROF_FLAGS_MEMORY + XHPROF_FLAGS_CPU);
Add the following when you want to stop profiling:
$name = time(); $type = "my-app-1"; $filename = "/var/www/profiles/$name.hub9.xhprof"; file_put_contents($filename, serialize(xhprof_disable()));`
I recommend you mount the profiles directory on your host. Ie, in your docker-compose:
app: image: tuimedia/base:alpine-profiler volumes: - ./profiles:/var/www/profiles
A note about naming: the XHProf UI is a piece of shit, but it works.
To use XHProf UI the profiles must be:
namemust a hexadecimal digit that returns true when passed to ctype_xdigit
typemust be present
- The name and type must be separated by a dot
- The file extension must be xhprof
Using the XHProf UI
There are a lot of UIs for XHProf. The simplest (hah) to setup is the UI included in XHProf.