Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Profiling PHP

From MoodleDocs

PHP has two significant profilers...

One is XDebug - this is well known and understood and it's trace output is supported by tools like KCachegrind.

The other is xhprof, a profiler released by facebook's engineering team, designed for capturing profile traces on live servers. Compared to XDebug, xhprof aims to have the minimum impact on execution times and require relatively little space to store a trace, so you can run it live without a noticeable impact on users and without filling disks. The trade off with xhprof is in slightly less detail and a trace format that needs it's own GUI to visualize (which ships with xhprof). The reason you'd want to profile in a live environments (vs. on development) is certain categories of problem may only been seen live, e.g. (data related) what happens when the user table grows 100 times, the impact on "login.php" or (service related) server to server HTTP requests. Did a presentation once XHProf - facebooks PHP profiler which explains in more detail - Penny saw the talk which is how I ended up writing this.

See also

XHProf articles:

Xdebug articles:

Template:CategoryDeveloper