summaryrefslogtreecommitdiff
path: root/includes/ProfilerStub.php
blob: e624e6f019b083d5f1beed75868c9c0c74350298 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
 * Stub profiling functions
 * @file
 * @ingroup Profiler
 */

/** backward compatibility */
$wgProfiling = false;
$wgProfiler = null;

/** is setproctitle function available ? */
$haveProctitle = function_exists( 'setproctitle' );

/**
 * Begin profiling of a function
 * @param $fn string
 */
function wfProfileIn( $fn = '' ) {
	global $hackwhere, $wgDBname, $haveProctitle;
	if( $haveProctitle ){
		$hackwhere[] = $fn;
		setproctitle( $fn . " [$wgDBname]" );
	}
}

/**
 * Stop profiling of a function
 * @param $fn string
 */
function wfProfileOut( $fn = '' ) {
	global $hackwhere, $wgDBname, $haveProctitle;
	if( !$haveProctitle ) {
		return;
	}
	if( count( $hackwhere ) ) {
		array_pop( $hackwhere );
	}
	if( count( $hackwhere ) ) {
		setproctitle( $hackwhere[count( $hackwhere )-1] . " [$wgDBname]" );
	}
}

/**
 * Does nothing, just for compatibility 
 */
function wfGetProfilingOutput( $s, $e ) {}

/**
 * Does nothing, just for compatibility 
 */
function wfProfileClose() {}