MediaWiki  REL1_24
Profiler Class Reference

Profiler base class that defines the interface and some trivial functionality. More...

Inheritance diagram for Profiler:
Collaboration diagram for Profiler:

List of all members.

Public Member Functions

 __construct (array $params)
 close ()
 Close opened profiling sections.
 getOutput ()
 Returns a profiling output to be stored in debug file.
 getProfileID ()
 getRawData ()
 isPersistent ()
 Return whether this profiler stores data.
 isStub ()
 Return whether this a stub profiler.
 logData ()
 Log the data to some store or even the page output.
 profileIn ($functionname)
 Called by wfProfieIn()
 profileOut ($functionname)
 Called by wfProfieOut()
 setProfileID ($id)
 setTemplated ($t)
 Mark this call as templated or not.
 transactionWritingIn ($server, $db, $id= '')
 Mark a DB as in a transaction with one or more writes pending.
 transactionWritingOut ($server, $db, $id= '')
 Mark a DB as no longer in a transaction.

Static Public Member Functions

static instance ()
 Singleton.
static setInstance (Profiler $p)
 Set the profiler to a specific profiler instance.

Static Public Attributes

static $__instance = null

Protected Member Functions

 debug ($s)
 Add an entry in the debug log file.
 debugGroup ($group, $s)
 Add an entry in the debug log group.
 getInitialTime ($metric= 'wall')
 Get the initial time of the request, based either on $wgRequestTime or $wgRUstart.
 getTime ($metric= 'wall')
 Get the initial time of the request, based either on $wgRequestTime or $wgRUstart.

Protected Attributes

string bool $mProfileID = false
 Profiler ID for bucketing data *.
bool $mTemplated = false
 Whether MediaWiki is in a SkinTemplate output context *.
TransactionProfiler $trxProfiler
 *

Detailed Description

Profiler base class that defines the interface and some trivial functionality.

Definition at line 112 of file Profiler.php.


Constructor & Destructor Documentation

Parameters:
array$params

Reimplemented in ProfilerStandard.

Definition at line 126 of file Profiler.php.


Member Function Documentation

Profiler::close ( ) [abstract]

Close opened profiling sections.

Reimplemented in ProfilerStandard, ProfilerMwprof, and ProfilerStub.

Profiler::debug ( s) [protected]

Add an entry in the debug log file.

Parameters:
string$sString to output

Definition at line 345 of file Profiler.php.

Profiler::debugGroup ( group,
s 
) [protected]

Add an entry in the debug log group.

Parameters:
string$groupGroup to send the message to
string$sString to output

Definition at line 357 of file Profiler.php.

Profiler::getInitialTime ( metric = 'wall') [protected]

Get the initial time of the request, based either on $wgRequestTime or $wgRUstart.

Will return null if not able to find data.

Parameters:
string | bool$metricMetric to use, with the following possibilities:
  • user: User CPU time (without system calls)
  • cpu: Total CPU time (user and system calls)
  • wall (or any other string): elapsed time
  • false (default): will fall back to default metric
Returns:
float|null

Definition at line 316 of file Profiler.php.

Profiler::getOutput ( ) [abstract]

Returns a profiling output to be stored in debug file.

Returns:
string

Reimplemented in ProfilerStandard, ProfilerMwprof, and ProfilerStub.

Returns:
string

Definition at line 195 of file Profiler.php.

Referenced by ProfilerSimpleUDP\logData().

Profiler::getRawData ( ) [abstract]
Returns:
array

Reimplemented in ProfilerStandard, ProfilerMwprof, and ProfilerStub.

Profiler::getTime ( metric = 'wall') [protected]

Get the initial time of the request, based either on $wgRequestTime or $wgRUstart.

Will return null if not able to find data.

Parameters:
string | bool$metricMetric to use, with the following possibilities:
  • user: User CPU time (without system calls)
  • cpu: Total CPU time (user and system calls)
  • wall (or any other string): elapsed time
  • false (default): will fall back to default metric
Returns:
float|null

Definition at line 287 of file Profiler.php.

Referenced by ProfilerSimpleTrace\profileOut().

Profiler::isPersistent ( ) [abstract]

Return whether this profiler stores data.

Called by Parser::braceSubstitution. If true, the parser will not generate per-title profiling sections, to avoid overloading the profiling data collector.

See also:
Profiler::logData()
Returns:
bool

Reimplemented in ProfilerStandard, ProfilerMwprof, ProfilerSimpleUDP, ProfilerSimpleDB, and ProfilerStub.

Profiler::isStub ( ) [abstract]

Return whether this a stub profiler.

Returns:
bool

Reimplemented in ProfilerStandard, ProfilerMwprof, and ProfilerStub.

Profiler::logData ( ) [abstract]

Log the data to some store or even the page output.

Reimplemented in ProfilerStandard, ProfilerMwprof, ProfilerSimpleTrace, ProfilerStub, ProfilerSimpleText, ProfilerSimpleDB, and ProfilerSimpleUDP.

Profiler::profileIn ( functionname) [abstract]

Called by wfProfieIn()

Parameters:
string$functionname

Reimplemented in ProfilerStandard, ProfilerMwprof, ProfilerStub, and ProfilerSimpleTrace.

Profiler::profileOut ( functionname) [abstract]

Called by wfProfieOut()

Parameters:
string$functionname

Reimplemented in ProfilerStandard, ProfilerMwprof, ProfilerSimpleTrace, and ProfilerStub.

static Profiler::setInstance ( Profiler p) [static, final]

Set the profiler to a specific profiler instance.

Mostly for dumpHTML

Parameters:
Profiler$p

Definition at line 162 of file Profiler.php.

Referenced by TestFileOpPerformance\execute(), and Maintenance\finalSetup().

Parameters:
string$id

Definition at line 188 of file Profiler.php.

Mark this call as templated or not.

Parameters:
bool$t

Definition at line 260 of file Profiler.php.

Profiler::transactionWritingIn ( server,
db,
id = '' 
)

Mark a DB as in a transaction with one or more writes pending.

Note that there can be multiple connections to a single DB.

Parameters:
string$serverDB server
string$dbDB name
string$idResource ID string of connection

Reimplemented in ProfilerStub.

Definition at line 226 of file Profiler.php.

Profiler::transactionWritingOut ( server,
db,
id = '' 
)

Mark a DB as no longer in a transaction.

This will check if locks are possibly held for longer than needed and log any affected transactions to a special DB log. Note that there can be multiple connections to a single DB.

Parameters:
string$serverDB server
string$dbDB name
string$idResource ID string of connection

Reimplemented in ProfilerStub.

Definition at line 241 of file Profiler.php.


Member Data Documentation

Profiler::$__instance = null [static]
string bool Profiler::$mProfileID = false [protected]

Profiler ID for bucketing data *.

Definition at line 113 of file Profiler.php.

bool Profiler::$mTemplated = false [protected]

Whether MediaWiki is in a SkinTemplate output context *.

Definition at line 114 of file Profiler.php.

TransactionProfiler Profiler::$trxProfiler [protected]

*

Definition at line 116 of file Profiler.php.


The documentation for this class was generated from the following file: