MediaWiki REL1_39
Xhprof.php
Go to the documentation of this file.
1<?php
31class Xhprof {
32
39 public static function enable( $flags = 0, $options = [] ) {
40 $args = [ $flags ];
41 if ( $options ) {
42 $args[] = $options;
43 }
44
46 [
47 'xhprof_enable',
48 'tideways_enable',
49 'tideways_xhprof_enable'
50 ],
51 $args
52 );
53 }
54
61 public static function disable() {
62 return self::callAny( [
63 'xhprof_disable',
64 'tideways_disable',
65 'tideways_xhprof_disable'
66 ] );
67 }
68
76 protected static function callAny( array $functions, array $args = [] ) {
77 foreach ( $functions as $func ) {
78 if ( function_exists( $func ) ) {
79 return $func( ...$args );
80 }
81 }
82
83 throw new Exception( "Neither xhprof nor tideways are installed" );
84 }
85}
Convenience class for working with XHProf https://github.com/phacility/xhprof.
Definition Xhprof.php:31
static enable( $flags=0, $options=[])
Start profiler.
Definition Xhprof.php:39
static disable()
Stop profiler.
Definition Xhprof.php:61
static callAny(array $functions, array $args=[])
Call the first available function from $functions.
Definition Xhprof.php:76
if( $line===false) $args
Definition mcc.php:124