]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - includes/ProfilerStub.php
MediaWiki 1.17.1
[autoinstallsdev/mediawiki.git] / includes / ProfilerStub.php
1 <?php
2 /**
3  * Stub profiling functions
4  * @file
5  * @ingroup Profiler
6  */
7
8 /** backward compatibility */
9 $wgProfiling = false;
10 $wgProfiler = null;
11
12 /** is setproctitle function available ? */
13 $haveProctitle = function_exists( 'setproctitle' );
14
15 /**
16  * Begin profiling of a function
17  * @param $fn string
18  */
19 function wfProfileIn( $fn = '' ) {
20         global $hackwhere, $wgDBname, $haveProctitle;
21         if( $haveProctitle ){
22                 $hackwhere[] = $fn;
23                 setproctitle( $fn . " [$wgDBname]" );
24         }
25 }
26
27 /**
28  * Stop profiling of a function
29  * @param $fn string
30  */
31 function wfProfileOut( $fn = '' ) {
32         global $hackwhere, $wgDBname, $haveProctitle;
33         if( !$haveProctitle ) {
34                 return;
35         }
36         if( count( $hackwhere ) ) {
37                 array_pop( $hackwhere );
38         }
39         if( count( $hackwhere ) ) {
40                 setproctitle( $hackwhere[count( $hackwhere )-1] . " [$wgDBname]" );
41         }
42 }
43
44 /**
45  * Does nothing, just for compatibility 
46  */
47 function wfGetProfilingOutput( $s, $e ) {}
48
49 /**
50  * Does nothing, just for compatibility 
51  */
52 function wfProfileClose() {}