Difference between revisions of "XHProf"
(Created page with "== History == Originally developed at Facebook, XHProf was open sourced in Mar, 2009. It was added to PHP's PECL, and the Facebook website stopped carrying it ~2014 The "sou...") |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | XHProf is enabled in [https://QualityBox.us QualityBox] to <strike>create the [//{{SERVERNAME}}/ServerPerformance Server Performance] graphs.</strike> (that's regular mysql). We use XHProf for actual profiling; which is turned off by default. | ||
+ | |||
+ | == Profiling your Wiki == | ||
+ | MediaWiki source has class interfaces in include/libs and uses XHProf plus custom profiling code to self analyze. When you edit a page on your wiki, you can get "Parser profiling data" at the bottom of the page which gives you important information about how "expensive" your page is. This is an important tool to allow site editors/admins know if they are doing something wrong with complex templates or function calls that would make the wiki slow. | ||
+ | |||
== History == | == History == | ||
Originally developed at Facebook, XHProf was open sourced in Mar, 2009. | Originally developed at Facebook, XHProf was open sourced in Mar, 2009. |
Latest revision as of 20:31, 12 February 2018
XHProf is enabled in QualityBox to create the Server Performance graphs. (that's regular mysql). We use XHProf for actual profiling; which is turned off by default.
Profiling your Wiki[edit | edit source]
MediaWiki source has class interfaces in include/libs and uses XHProf plus custom profiling code to self analyze. When you edit a page on your wiki, you can get "Parser profiling data" at the bottom of the page which gives you important information about how "expensive" your page is. This is an important tool to allow site editors/admins know if they are doing something wrong with complex templates or function calls that would make the wiki slow.
History[edit | edit source]
Originally developed at Facebook, XHProf was open sourced in Mar, 2009.
It was added to PHP's PECL, and the Facebook website stopped carrying it ~2014
The "source" lives at Evan Priestley's [1]GitHub where there have been 87 commits between 2009 and 2015. There haven't been any commits since Feb. 2015 (as of Feb. 2018). The relationship between the GitHub source and the PECL package is unclear[2]
Due to changes in PHP in the 7.0 release, there have been several forks to add PHP 7 support.
- https://github.com/longxinH/xhprof
- Tideways is one option, with commercial support and a cloud service.
TLDR;[edit | edit source]
git clone https://github.com/longxinH/xhprof
cd xhprof/extension
phpize (if is not found command then sudo apt-get install php7.0-dev)
./configure --with-php-config=/usr/bin/php-config7.0
sudo make && sudo make install
sudo vim /etc/php/7.0/fpm/php.ini
(if console app sudo vim /etc/php/7.0/cli/php.ini)
[xhprof]
extension=xhprof.so
xhprof.output_dir="/tmp/xhprof"
sudo service php7.0-fpm restart
#your script.php
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
Your code:
$xhprof_data = xhprof_disable();
include_once '/var/www/xhprof/xhprof_lib/utils/xhprof_lib.php';
include_once '/var/www/xhprof/xhprof_lib/utils/xhprof_runs.php';
$xhprof_runs = new \XHProfRuns_Default();
$run_id = $xhprof_runs->save_run($xhprof_data, 'your_project');
echo "<a href='http://xhprof/index.php?run={$run_id}&source=your_project' target='_blank'>profile</a>";
#http://xhprof is my localhost