6117bda5df28f74a27f2e5adbee6aaa6f51c371d
3 * Stub profiling functions
7 if ( !class_exists( 'Profiler' ) ) {
8 require_once( dirname( __FILE__
) . '/Profiler.php' );
11 class ProfilerStub
extends Profiler
{
14 * is setproctitle function available?
17 private $haveProctitle;
18 private $hackWhere = array();
21 * Constructor. Check for proctitle.
23 public function __construct() {
24 $this->haveProctitle
= function_exists( 'setproctitle' );
28 * Begin profiling of a function
31 public function profileIn( $fn = '' ) {
33 if( $this->haveProctitle
){
34 $this->hackWhere
[] = $fn;
35 setproctitle( $fn . " [$wgDBname]" );
40 * Stop profiling of a function
43 public function profileOut( $fn = '' ) {
45 if( !$this->haveProctitle
) {
48 if( count( $this->hackWhere
) ) {
49 array_pop( $this->hackWhere
);
51 if( count( $this->hackWhere
) ) {
52 setproctitle( $this->hackWhere
[count( $this->hackWhere
)-1] . " [$wgDBname]" );
57 * Does nothing, just for compatibility
59 public function getOutput() {}
60 public function close() {}
63 /** backward compatibility */
65 $wgProfiler = new ProfilerStub();