Profiling with XHProf

suggest change

XHProf is a PHP profiler originally written by Facebook, to provide a more lightweight alternative to XDebug.

After installing the xhprof PHP module, profiling can be enabled / disabled from PHP code:

xhprof_enable();
doSlowOperation();
$profile_data = xhprof_disable();

The returned array will contain data about the number of calls, CPU time and memory usage of each function that has been accessed inside doSlowOperation().

xhprof_sample_enable()/xhprof_sample_disable() can be used as a more lightweight option that will only log profiling information for a fraction of requests (and in a different format).

XHProf has some (mostly undocumented) helper functions to display the data (see example), or you can use other tools to visualize it (the platform.sh blog has an example).

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Performance:
* Profiling with XHProf

Table Of Contents
2 Arrays
4 Types
10 Cookies
14 JSON
15 SOAP
17 cURL
19 XML
21 Traits
35 UTF-8
36 URLs
38 PHPDoc
41 Loops
44 Closur
60 Performance
72 YAML
77 Cache
78 Streams
81 PDO
82 SQLite3
83 Sockets
87 MongoDB
93 IMAP
94 Redis
95 Imagick
102 APCu
108 PSR