MediaWiki REL1_27
|
Convenience class for working with XHProf https://github.com/phacility/xhprof. More...
Public Member Functions | |
__construct (array $config=[]) | |
Configuration data can contain: | |
getCallees ( $function) | |
Get a list of all callees from a given function. | |
getCallers ( $function) | |
Get a list of all callers of a given function. | |
getCompleteMetrics () | |
Get the inclusive and exclusive metrics for each function call. | |
getCriticalPath ( $metric='wt') | |
Find the critical path for the given metric. | |
getInclusiveMetrics () | |
Get the inclusive metrics for each function call. | |
getRawData () | |
Get raw data collected by xhprof. | |
loadRawData (array $data) | |
Load raw data from a prior run for analysis. | |
stop () | |
Stop collecting profiling data. | |
Static Public Member Functions | |
static | makeSortFunction ( $key, $sub) |
Make a closure to use as a sort function. | |
static | splitKey ( $key) |
Convert an xhprof data key into an array of ['parent', 'child'] function names. | |
Protected Member Functions | |
pruneData ( $data) | |
Remove data for functions that are not included in the 'include' configuration array. | |
Protected Attributes | |
$complete | |
Per-function inclusive and exclusive data. | |
$config | |
$hieraData | |
Hierarchical profiling data returned by xhprof. | |
$inclusive | |
Per-function inclusive data. | |
Convenience class for working with XHProf https://github.com/phacility/xhprof.
XHProf can be installed as a PECL package for use with PHP5 (Zend PHP) and is built-in to HHVM 3.3.0.
Definition at line 32 of file Xhprof.php.
Xhprof::__construct | ( | array | $config = [] | ) |
Configuration data can contain:
Note: When running under HHVM, xhprof will always behave as though the XHPROF_FLAGS_NO_BUILTINS flag has been used unless the Eval.JitEnableRenameFunction option is enabled for the HHVM process.
array | $config |
Definition at line 73 of file Xhprof.php.
References $config.
Xhprof::getCallees | ( | $function | ) |
Get a list of all callees from a given function.
string | $function | Function name |
Definition at line 381 of file Xhprof.php.
References getCompleteMetrics().
Referenced by getCriticalPath().
Xhprof::getCallers | ( | $function | ) |
Get a list of all callers of a given function.
string | $function | Function name |
Definition at line 365 of file Xhprof.php.
References getCompleteMetrics().
Xhprof::getCompleteMetrics | ( | ) |
Get the inclusive and exclusive metrics for each function call.
If data collection has not been stopped yet this method will halt collection to gather the profiling data.
In addition to the normal data contained in the inclusive metrics, the metrics have an additional 'exclusive' measurement which is the total minus the totals of all child function calls.
Definition at line 308 of file Xhprof.php.
References $complete, $value, as, complete, getInclusiveMetrics(), list, and splitKey().
Referenced by getCallees(), and getCallers().
Xhprof::getCriticalPath | ( | $metric = 'wt' | ) |
Find the critical path for the given metric.
string | $metric | Metric to find critical path for |
Definition at line 396 of file Xhprof.php.
References $path, as, getCallees(), and stop().
Xhprof::getInclusiveMetrics | ( | ) |
Get the inclusive metrics for each function call.
Inclusive metrics for given function include the metrics for all functions that were called from that function during the measurement period.
If data collection has not been stopped yet this method will halt collection to gather the profiling data.
See getRawData() for a description of the metric that are returned for each funcition call. The values for the wt, cpu, mu and pmu metrics are arrays with these values:
Definition at line 216 of file Xhprof.php.
References $i, $inclusive, $name, $value, as, list, splitKey(), and stop().
Referenced by getCompleteMetrics().
Xhprof::getRawData | ( | ) |
Get raw data collected by xhprof.
If data collection has not been stopped yet this method will halt collection to gather the profiling data.
Each key in the returned array is an edge label for the call graph in the form "caller==>callee". There is once special case edge labled simply "main()" which represents the global scope entry point of the application.
XHProf will collect different data depending on the flags that are used:
Definition at line 153 of file Xhprof.php.
References stop().
Xhprof::loadRawData | ( | array | $data | ) |
Load raw data from a prior run for analysis.
Stops any existing data collection and clears internal caches.
Any 'include' filters configured for this Xhprof instance will be enforced on the data as it is loaded. 'exclude' filters will however not be enforced as they are an XHProf intrinsic behavior.
array | $data |
Definition at line 116 of file Xhprof.php.
References complete, pruneData(), and stop().
|
static |
Make a closure to use as a sort function.
The resulting function will sort by descending numeric values (largest value first).
string | $key | Data key to sort on |
string | $sub | Sub key to sort array values on |
Definition at line 432 of file Xhprof.php.
References use.
|
protected |
Remove data for functions that are not included in the 'include' configuration array.
array | $data | Raw xhprof data |
Definition at line 177 of file Xhprof.php.
References as, list, and splitKey().
Referenced by loadRawData(), and stop().
|
static |
Convert an xhprof data key into an array of ['parent', 'child'] function names.
The resulting array is left padded with nulls, so a key with no parent (eg 'main()') will return [null, 'function'].
Definition at line 166 of file Xhprof.php.
Referenced by getCompleteMetrics(), getInclusiveMetrics(), pruneData(), XhprofTest\testCriticalPath(), and XhprofTest\testSplitKey().
Xhprof::stop | ( | ) |
Stop collecting profiling data.
Only the first invocation of this method will effect the internal object state. Subsequent calls will return the data collected by the initial call.
Definition at line 98 of file Xhprof.php.
References $hieraData, and pruneData().
Referenced by getCriticalPath(), getInclusiveMetrics(), getRawData(), and loadRawData().
|
protected |
Per-function inclusive and exclusive data.
Definition at line 55 of file Xhprof.php.
Referenced by getCompleteMetrics().
|
protected |
Definition at line 37 of file Xhprof.php.
Referenced by __construct().
|
protected |
Hierarchical profiling data returned by xhprof.
Definition at line 43 of file Xhprof.php.
Referenced by stop().
|
protected |
Per-function inclusive data.
Definition at line 49 of file Xhprof.php.
Referenced by getInclusiveMetrics().