MediaWiki  1.23.2
ProfilerSimpleTrace.php
Go to the documentation of this file.
1 <?php
30  var $trace = "Beginning trace: \n";
31  var $memory = 0;
32 
33  function profileIn( $functionname ) {
34  parent::profileIn( $functionname );
35  $this->trace .= " " . sprintf( "%6.1f", $this->memoryDiff() ) .
36  str_repeat( " ", count( $this->mWorkStack ) ) . " > " . $functionname . "\n";
37  }
38 
39  function profileOut( $functionname ) {
40  global $wgDebugFunctionEntry;
41 
42  if ( $wgDebugFunctionEntry ) {
43  $this->debug( str_repeat( ' ', count( $this->mWorkStack ) - 1 ) . 'Exiting ' . $functionname . "\n" );
44  }
45 
46  list( $ofname, /* $ocount */, $ortime ) = array_pop( $this->mWorkStack );
47 
48  if ( !$ofname ) {
49  $this->trace .= "Profiling error: $functionname\n";
50  } else {
51  if ( $functionname == 'close' ) {
52  $message = "Profile section ended by close(): {$ofname}";
53  $functionname = $ofname;
54  $this->trace .= $message . "\n";
55  }
56  elseif ( $ofname != $functionname ) {
57  $this->trace .= "Profiling error: in({$ofname}), out($functionname)";
58  }
59  $elapsedreal = $this->getTime() - $ortime;
60  $this->trace .= sprintf( "%03.6f %6.1f", $elapsedreal, $this->memoryDiff() ) .
61  str_repeat( " ", count( $this->mWorkStack ) + 1 ) . " < " . $functionname . "\n";
62 
63  $this->updateTrxProfiling( $functionname, $elapsedreal );
64  }
65  }
66 
67  function memoryDiff() {
68  $diff = memory_get_usage() - $this->memory;
69  $this->memory = memory_get_usage();
70  return $diff / 1024;
71  }
72 
73  function logData() {
74  if ( PHP_SAPI === 'cli' ) {
75  print "<!-- \n {$this->trace} \n -->";
76  } elseif ( $this->getContentType() === 'text/html' ) {
77  print "<!-- \n {$this->trace} \n -->";
78  } elseif ( $this->getContentType() === 'text/javascript' ) {
79  print "\n/*\n {$this->trace}\n*/";
80  } elseif ( $this->getContentType() === 'text/css' ) {
81  print "\n/*\n {$this->trace}\n*/";
82  }
83  }
84 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ProfilerSimpleTrace\$memory
$memory
Definition: ProfilerSimpleTrace.php:31
ProfilerSimpleTrace\profileIn
profileIn( $functionname)
Called by wfProfieIn()
Definition: ProfilerSimpleTrace.php:33
Profiler\getContentType
getContentType()
Get the content type sent out to the client.
Definition: Profiler.php:775
memory
MediaWiki has optional support for a high distributed memory object caching system For general information on but for a larger site with heavy like it should help lighten the load on the database servers by caching data and objects in memory
Definition: memcached.txt:10
Profiler\debug
debug( $s)
Add an entry in the debug log file.
Definition: Profiler.php:752
Profiler\getTime
getTime( $metric=false)
Get the initial time of the request, based either on $wgRequestTime or $wgRUstart.
Definition: Profiler.php:438
ProfilerSimpleTrace\profileOut
profileOut( $functionname)
Called by wfProfieOut()
Definition: ProfilerSimpleTrace.php:39
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ProfilerSimpleTrace\memoryDiff
memoryDiff()
Definition: ProfilerSimpleTrace.php:67
ProfilerSimpleTrace
Execution trace.
Definition: ProfilerSimpleTrace.php:29
list
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
ProfilerSimpleTrace\logData
logData()
Log the whole profiling data into the database.
Definition: ProfilerSimpleTrace.php:73
Profiler\updateTrxProfiling
updateTrxProfiling( $method, $realtime)
Register the name and time of a method for slow DB trx detection.
Definition: Profiler.php:283
ProfilerSimpleTrace\$trace
$trace
Definition: ProfilerSimpleTrace.php:30
ProfilerSimple
Simple profiler base class.
Definition: ProfilerSimple.php:29