* @since 1.23
*/
class ProfilerMwprof extends Profiler {
+ /** @var array Queue of open profile calls with start data */
+ protected $mWorkStack = array();
+
+ /** @var array Map of (function name => aggregate data array) */
+ protected $mCollated = array();
+ /** @var array Cache of a standard broken collation entry */
+ protected $mErrorEntry;
+
// Message types
const TYPE_SINGLE = 1;
const TYPE_RUNNING = 2;
- protected function collateOnly() {
+ public function isStub() {
return false;
}
- /**
- * Indicate that this Profiler subclass is persistent.
- *
- * Called by Parser::braceSubstitution. If true, the parser will not
- * generate per-title profiling sections, to avoid overloading the
- * profiling data collector.
- *
- * @return bool true
- */
public function isPersistent() {
return true;
}
$elapsedCpu = $this->getTime( 'cpu' ) - $inCpu;
$elapsedWall = $this->getTime() - $inWall;
$this->updateRunningEntry( $outName, $elapsedCpu, $elapsedWall );
- $this->updateTrxProfiling( $outName, $elapsedWall );
+ $this->trxProfiler->recordFunctionCompletion( $outName, $elapsedWall );
}
/**
* Update an entry with timing data.
*
* @param string $name Section name
- * @param float $elapsedCpu elapsed CPU time
- * @param float $elapsedWall elapsed wall-clock time
+ * @param float $elapsedCpu Elapsed CPU time
+ * @param float $elapsedWall Elapsed wall-clock time
*/
public function updateRunningEntry( $name, $elapsedCpu, $elapsedWall ) {
// If this is the first measurement for this entry, store plain values.
$entry['wall']->push( $elapsedWall );
}
- /**
- * Produce an empty function report.
- *
- * ProfileMwprof does not provide a function report.
- *
- * @return string Empty string.
- */
- public function getFunctionReport() {
- return '';
- }
-
/**
* @return array
*/
foreach ( $profile as &$item ) {
$item['percent'] = $totalWall ? 100 * $item['elapsed'] / $totalWall : 0;
- $z+= $item['percent'];
}
return $profile;
$this->close();
if ( !function_exists( 'socket_create' ) ) {
- #trigger_error( __METHOD__ . ": function \"socket_create\" not found." );
return; // avoid fatal
}
socket_send( $sock, $buffer, $bufferLength, 0 );
}
}
+
+ /**
+ * Close opened profiling sections
+ */
+ public function close() {
+ while ( count( $this->mWorkStack ) ) {
+ $this->profileOut( 'close' );
+ }
+ }
+
+ public function getOutput() {
+ return ''; // no report
+ }
}