<?php
/**
* This file is only included if profiling is enabled
- * @package MediaWiki
*/
$wgProfiling = true;
/**
* @todo document
- * @package MediaWiki
*/
class Profiler {
var $mStack = array (), $mWorkStack = array (), $mCollated = array ();
var $mCalls = array (), $mTotals = array ();
- function Profiler()
- {
+ function __construct() {
// Push an entry for the pre-profile setup time onto the stack
global $wgRequestTime;
if ( !empty( $wgRequestTime ) ) {
} else {
$this->profileIn( '-total' );
}
-
}
function profileIn($functionname) {
}
function getCallTreeLine($entry) {
- list ($fname, $level, $start, $x, $end) = $entry;
+ list ($fname, $level, $start, /* $x */, $end) = $entry;
$delta = $end - $start;
$space = str_repeat(' ', $level);
# First, subtract the overhead!
foreach ($this->mStack as $entry) {
$fname = $entry[0];
- $thislevel = $entry[1];
$start = $entry[2];
$end = $entry[4];
$elapsed = $end - $start;
# Collate
foreach ($this->mStack as $index => $entry) {
$fname = $entry[0];
- $thislevel = $entry[1];
$start = $entry[2];
$end = $entry[4];
$elapsed = $end - $start;
* @return Integer
* @private
*/
- function calltreeCount(& $stack, $start) {
+ function calltreeCount($stack, $start) {
$level = $stack[$start][1];
$count = 0;
for ($i = $start -1; $i >= 0 && $stack[$i][1] > $level; $i --) {
global $wguname, $wgProfilePerHost;
$fname = 'Profiler::logToDB';
- $dbw = & wfGetDB(DB_MASTER);
+ $dbw = wfGetDB(DB_MASTER);
if (!is_object($dbw))
return false;
$errorState = $dbw->ignoreErrors( true );
}
static function getCaller( $level ) {
- $backtrace = debug_backtrace();
+ $backtrace = wfDebugBacktrace();
if ( isset( $backtrace[$level] ) ) {
if ( isset( $backtrace[$level]['class'] ) ) {
$caller = $backtrace[$level]['class'] . '::' . $backtrace[$level]['function'];