51 $entry =& $this->mCollated[
$name];
52 if ( !is_array( $entry ) ) {
54 $this->mCollated[
$name] =& $entry;
56 $entry[
'cpu'] += $elapsedCpu;
57 $entry[
'cpu_sq'] += $elapsedCpu * $elapsedCpu;
58 $entry[
'real'] += $elapsedReal;
59 $entry[
'real_sq'] += $elapsedReal * $elapsedReal;
73 if ( $initialTime !==
null && $initialCpu !==
null ) {
74 $this->mWorkStack[] =
array(
'-total', 0, $initialTime, $initialCpu );
75 $this->mWorkStack[] =
array(
'-setup', 1, $initialTime, $initialCpu );
84 $this->mMinimumTime = $min;
88 global $wgDebugFunctionEntry;
89 if ( $wgDebugFunctionEntry ) {
90 $this->
debug( str_repeat(
' ', count( $this->mWorkStack ) ) .
'Entering ' . $functionname .
"\n" );
92 $this->mWorkStack[] =
array( $functionname, count( $this->mWorkStack ), $this->
getTime(), $this->
getTime(
'cpu' ) );
96 global $wgDebugFunctionEntry;
98 if ( $wgDebugFunctionEntry ) {
99 $this->
debug( str_repeat(
' ', count( $this->mWorkStack ) - 1 ) .
'Exiting ' . $functionname .
"\n" );
102 list( $ofname, , $ortime, $octime ) = array_pop( $this->mWorkStack );
105 $this->
debugGroup(
'profileerror',
"Profiling error: $functionname" );
107 if ( $functionname ==
'close' ) {
108 if ( $ofname !=
'-total' ) {
109 $message =
"Profile section ended by close(): {$ofname}";
110 $this->
debugGroup(
'profileerror', $message );
113 $functionname = $ofname;
114 } elseif ( $ofname != $functionname ) {
115 $message =
"Profiling error: in({$ofname}), out($functionname)";
116 $this->
debugGroup(
'profileerror', $message );
119 $elapsedcpu = $this->
getTime(
'cpu' ) - $octime;
120 $elapsedreal = $this->
getTime() - $ortime;
121 $this->
updateEntry( $functionname, $elapsedcpu, $elapsedreal );