jenkins-bot has submitted this change and it was merged.
Change subject: Xhprof improvements
......................................................................
Xhprof improvements
- Install xhprof unconditionally with php5. HHVM ships with it
and it's a great development tool. Use the package since it
Just Works and remove the chain of exec{} calls
- Refactor xhprof role into xhprofgui role which installs the
xhprof_html from Github and aliases it to /xhprof as before.
Change-Id: Icac3c46e8838633c7bf52f54ebc51cc72ff9b020
---
M .gitignore
M puppet/modules/php/manifests/init.pp
D puppet/modules/role/manifests/xhprof.pp
A puppet/modules/role/manifests/xhprofgui.pp
D puppet/modules/xhprof/files/xhprof-apache-config
D puppet/modules/xhprof/manifests/init.pp
A puppet/modules/xhprofgui/files/xhprof-apache-config
A puppet/modules/xhprofgui/manifests/init.pp
8 files changed, 82 insertions(+), 102 deletions(-)
Approvals:
BryanDavis: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.gitignore b/.gitignore
index 82e44fe..893a72f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,4 @@
/wikimetrics/
/mathoid
/iegreview
+/profiles
diff --git a/puppet/modules/php/manifests/init.pp
b/puppet/modules/php/manifests/init.pp
index a269aaa..99b5b41 100644
--- a/puppet/modules/php/manifests/init.pp
+++ b/puppet/modules/php/manifests/init.pp
@@ -25,6 +25,7 @@
'php5-mysql',
'php5-sqlite',
'php5-readline',
+ 'php5-xhprof',
]:
ensure => present,
require => Class['::apache::mod::php5'],
diff --git a/puppet/modules/role/manifests/xhprof.pp
b/puppet/modules/role/manifests/xhprof.pp
deleted file mode 100644
index 4b81ffc..0000000
--- a/puppet/modules/role/manifests/xhprof.pp
+++ /dev/null
@@ -1,21 +0,0 @@
-# == Class: role::xhprof
-# This class enables support for function-level hierarchical profiling of PHP
-# using XHProf. The graphical interface for the profiler is available at
-# /xhprof on the same port as the wiki.
-#
-# You can add the following code to $IP/StartProfiler.php to use XHProf with
-# MediaWiki:
-#
-# xhprof_enable( XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY );
-# register_shutdown_function( function() {
-# $profile = xhprof_disable();
-# require_once 'xhprof_lib/utils/xhprof_runs.php';
-# $runs = new XHProfRuns_Default();
-# $runs->save_run( $profile, 'mw' );
-# } );
-#
-class role::xhprof {
- include ::xhprof
-
- require_package('graphviz')
-}
diff --git a/puppet/modules/role/manifests/xhprofgui.pp
b/puppet/modules/role/manifests/xhprofgui.pp
new file mode 100644
index 0000000..07d3a23
--- /dev/null
+++ b/puppet/modules/role/manifests/xhprofgui.pp
@@ -0,0 +1,25 @@
+# == Class: role::xhprofgui
+# This class enables a UI for viewing xhprof run data. Xhprof is already
+# installed by default for PHP5 and MediaWiki.
+#
+# To use xhprofgui to profile MediaWiki you can do esomthing like this
+# in your StartProfiler.php:
+#
+# set_include_path( get_include_path() . PATH_SEPARATOR . '/srv/xhprof' );
+# xhprof_enable( XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY );
+# register_shutdown_function( function() {
+# $profile = xhprof_disable();
+# require_once 'xhprof_lib/utils/xhprof_lib.php';
+# require_once 'xhprof_lib/utils/xhprof_runs.php';
+# $runs = new XHProfRuns_Default();
+# $runs->save_run( $profile, 'mw' );
+# } );
+#
+
+# Then browse to 127.0.0.1:8080/xhprof to view the data
+#
+class role::xhprofgui {
+ include ::xhprofgui
+
+ require_package('graphviz')
+}
diff --git a/puppet/modules/xhprof/files/xhprof-apache-config
b/puppet/modules/xhprof/files/xhprof-apache-config
deleted file mode 100644
index 4d83082..0000000
--- a/puppet/modules/xhprof/files/xhprof-apache-config
+++ /dev/null
@@ -1,11 +0,0 @@
-# vim: filetype=apache sts=4 sw=4 autoindent
-#
-# Apache site configuration for XHProf
-# This file is managed by Puppet.
-#
-
-<Directory /usr/share/php/xhprof_html>
-</Directory>
-
-Alias /xhprof "/usr/share/php/xhprof_html"
-
diff --git a/puppet/modules/xhprof/manifests/init.pp
b/puppet/modules/xhprof/manifests/init.pp
deleted file mode 100644
index 3772adb..0000000
--- a/puppet/modules/xhprof/manifests/init.pp
+++ /dev/null
@@ -1,70 +0,0 @@
-# == Class: xhprof
-#
-# This Puppet class configures XHProf, a function-level hierarchical
-# profiler for PHP with a simple HTML based navigational interface.
-#
-# === Parameters
-#
-# [*profile_storage_dir*]
-# Path where profiles should be stored. Default: '/vagrant/profiles'.
-#
-class xhprof (
- $profile_storage_dir = '/vagrant/profiles'
-) {
-
- $xhprof_version = '0.9.4'
- $installed_module = '/usr/lib/php5/20121212/xhprof.so'
-
- exec { 'download_xhprof':
- cwd => '/tmp',
- creates => $installed_module,
- command => "wget http://pecl.php.net/get/xhprof-${xhprof_version}.tgz",
- }
-
- exec { 'extract_xhprof':
- cwd => '/tmp',
- command => "tar -xzf xhprof-${xhprof_version}.tgz",
- creates => $installed_module,
- require => Exec['download_xhprof'],
- }
-
- exec { 'install_xhprof':
- cwd => "/tmp/xhprof-${xhprof_version}/extension",
- command => 'phpize && ./configure && make && make install',
- creates => $installed_module,
- require => [ Exec['extract_xhprof'], Package['php5-dev'] ],
- }
-
- exec { 'install_xhprof_assets':
- cwd => "/tmp/xhprof-${xhprof_version}",
- command => "cp -rf /tmp/xhprof-${xhprof_version}/xhprof_html
/tmp/xhprof-${xhprof_version}/xhprof_lib /usr/share/php",
- creates => '/usr/share/php/xhprof_html',
- # php-pear ensures existance of /usr/share/php, better way?
- require => [ Exec['install_xhprof'], Package['php-pear'] ],
- }
-
- php::ini { 'xhprof':
- require => Exec['install_xhprof'],
- settings => {
- 'extension' => 'xhprof.so',
- # Not used by the extension directly, used by the
- # XHProf_Runs utility class
- 'xhprof.output_dir' => $profile_storage_dir,
- }
- }
-
- # Directory used, by default, to store profile runs
- file { $profile_storage_dir:
- ensure => directory,
- owner => $::share_owner,
- group => $::share_group,
- mode => '0775',
- }
-
- # Enable xhprof viewer on /xhprof directory of devwiki
- apache::conf { 'xhprof':
- ensure => present,
- source => 'puppet:///modules/xhprof/xhprof-apache-config',
- require => Php::Ini['xhprof'],
- }
-}
diff --git a/puppet/modules/xhprofgui/files/xhprof-apache-config
b/puppet/modules/xhprofgui/files/xhprof-apache-config
new file mode 100644
index 0000000..ac8b122
--- /dev/null
+++ b/puppet/modules/xhprofgui/files/xhprof-apache-config
@@ -0,0 +1,12 @@
+# vim: filetype=apache sts=4 sw=4 autoindent
+#
+# Apache site configuration for XHProf
+# This file is managed by Puppet.
+#
+
+<Directory /srv/xhprof/xhprof_html>
+ Require all granted
+</Directory>
+
+Alias /xhprof "/srv/xhprof/xhprof_html"
+
diff --git a/puppet/modules/xhprofgui/manifests/init.pp
b/puppet/modules/xhprofgui/manifests/init.pp
new file mode 100644
index 0000000..0fdfe88
--- /dev/null
+++ b/puppet/modules/xhprofgui/manifests/init.pp
@@ -0,0 +1,43 @@
+# == Class: xhprof
+#
+# This Puppet class configures XHProf, a function-level hierarchical
+# profiler for PHP with a simple HTML based navigational interface.
+#
+# === Parameters
+#
+# [*profile_storage_dir*]
+# Path where profiles should be stored. Default: '/vagrant/profiles'.
+#
+class xhprofgui (
+ $profile_storage_dir = '/vagrant/profiles'
+) {
+
+ git::install { 'phacility/xhprof':
+ directory => "/srv/xhprof",
+ remote => "https://github.com/phacility/xhprof",
+ commit => "HEAD",
+ }
+
+ php::ini { 'xhprofgui':
+ settings => {
+ # Not used by the extension directly, used by the
+ # XHProf_Runs utility class
+ 'xhprof.output_dir' => $profile_storage_dir,
+ }
+ }
+
+ # Directory used, by default, to store profile runs
+ file { $profile_storage_dir:
+ ensure => directory,
+ owner => $::share_owner,
+ group => $::share_group,
+ mode => '0775',
+ }
+
+ # Enable xhprof viewer on /xhprof directory of devwiki
+ apache::conf { 'xhprof':
+ ensure => present,
+ source => 'puppet:///modules/xhprofgui/xhprof-apache-config',
+ require => Php::Ini['xhprofgui'],
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/177479
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icac3c46e8838633c7bf52f54ebc51cc72ff9b020
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits