[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/profiler/ -> Profiler.php (summary)

Base class and functions for profiling. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 469 lines (13 kb)
Included or required:0 times
Referenced: 3 times
Includes or requires: 0 files

Defines 2 classes

ProfileSection:: (14 methods):
  __construct()
  __destruct()
  __construct()
  instance()
  setInstance()
  setProfileID()
  getProfileID()
  transactionWritingIn()
  transactionWritingOut()
  setTemplated()
  getTime()
  getInitialTime()
  debug()
  debugGroup()

TransactionProfiler:: (3 methods):
  transactionWritingIn()
  recordFunctionCompletion()
  transactionWritingOut()

Defines 3 functions

  wfGetRusage()
  wfProfileIn()
  wfProfileOut()

Class: ProfileSection  - X-Ref

Class for handling function-scope profiling

__construct( $name )   X-Ref
Begin profiling of a function and return an object that ends profiling of
the function when that object leaves scope. As long as the object is not
specifically linked to other objects, it will fall out of scope at the same
moment that the function to be profiled terminates.

This is typically called like:
<code>$section = new ProfileSection( __METHOD__ );</code>

param: string $name Name of the function to profile

__destruct()   X-Ref
No description

__construct( array $params )   X-Ref

param: array $params

instance()   X-Ref
Singleton

return: Profiler

setInstance( Profiler $p )   X-Ref
Set the profiler to a specific profiler instance. Mostly for dumpHTML

param: Profiler $p

setProfileID( $id )   X-Ref

param: string $id

getProfileID()   X-Ref

return: string

transactionWritingIn( $server, $db, $id = '' )   X-Ref
Mark a DB as in a transaction with one or more writes pending

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

param: string $server DB server
param: string $db DB name
param: string $id Resource ID string of connection

transactionWritingOut( $server, $db, $id = '' )   X-Ref
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.

param: string $server DB server
param: string $db DB name
param: string $id Resource ID string of connection

setTemplated( $t )   X-Ref
Mark this call as templated or not

param: bool $t

getTime( $metric = 'wall' )   X-Ref
Get the initial time of the request, based either on $wgRequestTime or
$wgRUstart. Will return null if not able to find data.

param: string|bool $metric Metric to use, with the following possibilities:
return: float|null

getInitialTime( $metric = 'wall' )   X-Ref
Get the initial time of the request, based either on $wgRequestTime or
$wgRUstart. Will return null if not able to find data.

param: string|bool $metric Metric to use, with the following possibilities:
return: float|null

debug( $s )   X-Ref
Add an entry in the debug log file

param: string $s String to output

debugGroup( $group, $s )   X-Ref
Add an entry in the debug log group

param: string $group Group to send the message to
param: string $s String to output

Class: TransactionProfiler  - X-Ref

Helper class that detects high-contention DB queries via profiling calls

This class is meant to work with a Profiler, as the later already knows
when methods start and finish (which may take place during transactions).

transactionWritingIn( $server, $db, $id )   X-Ref
Mark a DB as in a transaction with one or more writes pending

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

param: string $server DB server
param: string $db DB name
param: string $id ID string of transaction

recordFunctionCompletion( $method, $realtime )   X-Ref
Register the name and time of a method for slow DB trx detection

This method is only to be called by the Profiler class as methods finish

param: string $method Function name
param: float $realtime Wal time ellapsed

transactionWritingOut( $server, $db, $id )   X-Ref
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.

param: string $server DB server
param: string $db DB name
param: string $id ID string of transaction

Functions
Functions that are not part of a class:

wfGetRusage()   X-Ref
Get system resource usage of current request context.
Invokes the getrusage(2) system call, requesting RUSAGE_SELF if on PHP5
or RUSAGE_THREAD if on HHVM. Returns false if getrusage is not available.

return: array|bool Resource usage data or false if no data available.

wfProfileIn( $functionname )   X-Ref
Begin profiling of a function

param: string $functionname Name of the function we will profile

wfProfileOut( $functionname = 'missing' )   X-Ref
Stop profiling of a function

param: string $functionname Name of the function we have profiled



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1