Note:

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

Setting up xhprof on Moodle: Difference between revisions

From MoodleDocs
m (Protected "Setting up xhprof on Moodle": Developer Docs Migration ([Edit=Allow only administrators] (indefinite)))
 
(34 intermediate revisions by 15 users not shown)
Line 1: Line 1:
The following instructions are for setting up xhprof for Moodle under a Ubuntu/Debian environment. The process should be similar for other linux enviroments, but will need some tweaking if you wish to do this under windows. Please update this document if you find any major problems.
{{Template:Migrated|newDocId=/docs/guides/profiling/}}
 
==Installing xhprof==
 
<code bash>
mkdir ~/src/
cd ~/src/
wget http://pecl.php.net/get/xhprof-0.9.2.tgz
tar xvf xhprof-0.9.2.tgz
cd xhprof-0.9.2/extension/
phpize
./configure
make
sudo make install
</code>
 
Add the following to the apache version of you php.ini file
 
<code ini>
[xhprof]
extension=xhprof.so
xhprof.output_dir="/var/tmp/xhprof"
</code>
 
Restart Apache
<code bash>
sudo service apache2 retart
</code>
 
Create a file in your web root that makes a call to phpinfo(); and then view the result in your browser to make sure that xhprof is enabled in PHP. Checking the output of '''php -m''' would also work if you are sure that the command line version of PHP uses the same php.ini file as your web server.
 
==Configuring Moodle to use xhprof==
[[Image:profilingOption.png|thumb|center|The profiling option is displayed when the php xhprof extension is installed]]
[[Image:profilingSettings.png|frame|center|Enabling profiling and setting it to run on all pages via a wildcard]]
[[Image:profilingRuns.png|frame|center|A profiling runs option can be seen after enabling profiling]]
[[Image:profilingOutput.png|thumb|center|Tabular profiling output produced by xhprof]]
[[Image:callgraph.png|thumb|center|An example call graph showing slow parts of the profiled run]]

Latest revision as of 00:44, 22 May 2023

Important:

This content of this page has been updated and migrated to the new Moodle Developer Resources. The information contained on the page should no longer be seen up-to-date.

Why not view this page on the new site and help us to migrate more content to the new site!