X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2FXhprof.php;h=016c9b1574fa91042cbdcba9e81bade9ce1e072b;hb=2c12b1fd2afc14a03c16f05c844320985d911ca0;hp=9c1ec8eb013bf671270eb9de6183b8a213b5a829;hpb=5fd224c00b940f75c1f83e56b99961be94bde70a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/Xhprof.php b/includes/libs/Xhprof.php index 9c1ec8eb01..016c9b1574 100644 --- a/includes/libs/Xhprof.php +++ b/includes/libs/Xhprof.php @@ -23,6 +23,10 @@ * . XHProf can be installed as a PECL * package for use with PHP5 (Zend PHP) and is built-in to HHVM 3.3.0. * + * This also supports using the Tideways profiler + * , which additionally + * has support for PHP7. + * * @since 1.28 */ class Xhprof { @@ -43,10 +47,16 @@ class Xhprof { */ public static function enable( $flags = 0, $options = [] ) { if ( self::isEnabled() ) { - throw new Exception( 'Xhprof profiling is already enabled.' ); + throw new Exception( 'Profiling is already enabled.' ); } self::$enabled = true; - xhprof_enable( $flags, $options ); + if ( function_exists( 'xhprof_enable' ) ) { + xhprof_enable( $flags, $options ); + } elseif ( function_exists( 'tideways_enable' ) ) { + tideways_enable( $flags, $options ); + } else { + throw new Exception( "Neither xhprof nor tideways are installed" ); + } } /** @@ -57,7 +67,12 @@ class Xhprof { public static function disable() { if ( self::isEnabled() ) { self::$enabled = false; - return xhprof_disable(); + if ( function_exists( 'xhprof_disable' ) ) { + return xhprof_disable(); + } else { + // tideways + return tideways_disable(); + } } } }