phacility/xhprof — pull request #41 by beberlei (2014-07-30 22:20:06+00:00)
Title: Track function arguments of whitelisted functions with special cases

This patch is based on work by Syseleven (https://github.com/syseleven/xhprof) and adds the following functionality to XHProf:

- Add option 'argument_functions' that tracks arguments of whitelisted set of functions.
- Arguments are added behind # after the function call itself.
- Several php internal methods have special handling for tracking arguments:
- PDOStatement::execute if tracked will contain the SQL query.
- curl_exec if tracked will contain the called URL
- A big set of stream related functions will contain the opened file (independent of stream type): fgets, fread, fputs, fwrite, fgetcsv, stream_get_contents if there is one.

Compiling this patch is tricky because of the curl dependency. You need to copy the file `ext/curl/php_curl.h` from the PHP-src to your include folder, for example `/usr/include/php/ext/curl/php_curl.h`. PHP does not expose php_curl.h by default, the header is only necessary because we need to access the struct `php_curl` for accessing the effective URL during `curl_exec` calls.