'udp' => 'ProfilerOutputUdp',
);
- // @codingStandardsIgnoreStart PSR2.Classes.PropertyDeclaration.Underscore
- /** @var Profiler Do not call this outside Profiler and ProfileSection */
- public static $__instance = null;
- // @codingStandardsIgnoreEnd
+ /** @var Profiler */
+ private static $instance = null;
/**
* @param array $params
* @return Profiler
*/
final public static function instance() {
- if ( self::$__instance === null ) {
+ if ( self::$instance === null ) {
global $wgProfiler;
if ( is_array( $wgProfiler ) ) {
$class = isset( $wgProfiler['class'] ) ? $wgProfiler['class'] : 'ProfilerStub';
if ( PHP_SAPI === 'cli' || mt_rand( 0, $factor - 1 ) != 0 ) {
$class = 'ProfilerStub';
}
- /** @var Profiler */
- self::$__instance = new $class( $wgProfiler );
+ self::$instance = new $class( $wgProfiler );
} else {
- self::$__instance = new ProfilerStub( array() );
+ self::$instance = new ProfilerStub( array() );
}
}
- return self::$__instance;
+ return self::$instance;
}
/**
* @since 1.25
*/
final public static function replaceStubInstance( Profiler $profiler ) {
- if ( self::$__instance && !( self::$__instance instanceof ProfilerStub ) ) {
+ if ( self::$instance && !( self::$instance instanceof ProfilerStub ) ) {
throw new MWException( 'Could not replace non-stub profiler instance.' );
} else {
- self::$__instance = $profiler;
+ self::$instance = $profiler;
}
}
}
}
- /**
- * Called by wfProfieIn()
- *
- * @param string $functionname
- */
- abstract public function profileIn( $functionname );
-
- /**
- * Called by wfProfieOut()
- *
- * @param string $functionname
- */
- abstract public function profileOut( $functionname );
+ // Kept BC for now, remove when possible
+ public function profileIn( $functionname ) {}
+ public function profileOut( $functionname ) {}
/**
* Mark the start of a custom profiling frame (e.g. DB queries).
* This makes filtering them out easier and follows the xhprof style.
*
* @return array List of method entries arrays, each having:
- * - name : method name
- * - calls : the number of invoking calls
- * - real : real time ellapsed (ms)
- * - %real : percent real time
- * - cpu : CPU time ellapsed (ms)
- * - %cpu : percent CPU time
- * - memory : memory used (bytes)
- * - %memory : percent memory used
+ * - name : method name
+ * - calls : the number of invoking calls
+ * - real : real time ellapsed (ms)
+ * - %real : percent real time
+ * - cpu : CPU time ellapsed (ms)
+ * - %cpu : percent CPU time
+ * - memory : memory used (bytes)
+ * - %memory : percent memory used
+ * - min_real : min real time in a call (ms)
+ * - max_real : max real time in a call (ms)
* @since 1.25
*/
abstract public function getFunctionStats();