From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/profiler/ProfilerSimpleTrace.php | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 includes/profiler/ProfilerSimpleTrace.php (limited to 'includes/profiler/ProfilerSimpleTrace.php') diff --git a/includes/profiler/ProfilerSimpleTrace.php b/includes/profiler/ProfilerSimpleTrace.php new file mode 100644 index 00000000..ba41babc --- /dev/null +++ b/includes/profiler/ProfilerSimpleTrace.php @@ -0,0 +1,67 @@ +mWorkStack[] = array( '-total', 0, $wgRequestTime, $this->getCpuTime( $wgRUstart ) ); + } + $this->trace .= "Beginning trace: \n"; + } + + function profileIn($functionname) { + $this->mWorkStack[] = array($functionname, count( $this->mWorkStack ), microtime(true), $this->getCpuTime()); + $this->trace .= " " . sprintf("%6.1f",$this->memoryDiff()) . + str_repeat( " ", count($this->mWorkStack)) . " > " . $functionname . "\n"; + } + + function profileOut($functionname) { + global $wgDebugFunctionEntry; + + if ( $wgDebugFunctionEntry ) { + $this->debug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n"); + } + + list( $ofname, /* $ocount */ , $ortime, $octime ) = array_pop( $this->mWorkStack ); + + if ( !$ofname ) { + $this->trace .= "Profiling error: $functionname\n"; + } else { + if ( $functionname == 'close' ) { + $message = "Profile section ended by close(): {$ofname}"; + $functionname = $ofname; + $this->trace .= $message . "\n"; + } + elseif ( $ofname != $functionname ) { + $this->trace .= "Profiling error: in({$ofname}), out($functionname)"; + } + $elapsedreal = microtime( true ) - $ortime; + $this->trace .= sprintf( "%03.6f %6.1f", $elapsedreal, $this->memoryDiff() ) . + str_repeat(" ", count( $this->mWorkStack ) + 1 ) . " < " . $functionname . "\n"; + } + } + + function memoryDiff() { + $diff = memory_get_usage() - $this->memory; + $this->memory = memory_get_usage(); + return $diff / 1024; + } + + function logData() { + print ""; + } +} -- cgit v1.2.3-54-g00ecf