summaryrefslogtreecommitdiff
path: root/includes/ProfilerStub.php
blob: 100cb8df1058519a130971fe1c7a7ad253ad964b (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
<?php
/**
 * Stub profiling functions
 * @file
 * @ingroup Profiler
 */

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

/** 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() {}