MediaWiki REL1_33
|
Convenience class for working with XHProf profiling data https://github.com/phacility/xhprof. More...
Public Member Functions | |
__construct (array $data, 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. | |
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 profiling data 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 31 of file XhprofData.php.
Configuration data can contain:
array | $data | Xhprof profiling data, as returned by xhprof_disable() |
array | $config |
Definition at line 64 of file XhprofData.php.
References $config, and(), and pruneData().
XhprofData::getCallees | ( | $function | ) |
Get a list of all callees from a given function.
string | $function | Function name |
Definition at line 319 of file XhprofData.php.
References and(), and getCompleteMetrics().
Referenced by getCriticalPath().
XhprofData::getCallers | ( | $function | ) |
Get a list of all callers of a given function.
string | $function | Function name |
Definition at line 303 of file XhprofData.php.
References and(), and getCompleteMetrics().
XhprofData::getCompleteMetrics | ( | ) |
Get the inclusive and exclusive metrics for each function call.
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 246 of file XhprofData.php.
References $complete, $parent, $value, and(), complete, getInclusiveMetrics(), list, and splitKey().
Referenced by getCallees(), and getCallers().
XhprofData::getCriticalPath | ( | $metric = 'wt' | ) |
Find the critical path for the given metric.
string | $metric | Metric to find critical path for |
Definition at line 334 of file XhprofData.php.
References $path, and(), and getCallees().
XhprofData::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.
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 160 of file XhprofData.php.
References $inclusive, $name, $parent, $value, and(), list, and splitKey().
Referenced by getCompleteMetrics().
XhprofData::getRawData | ( | ) |
Get raw data collected by xhprof.
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 99 of file XhprofData.php.
References $hieraData.
|
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 369 of file XhprofData.php.
References and().
|
protected |
Remove data for functions that are not included in the 'include' configuration array.
array | $data | Raw xhprof data |
Definition at line 124 of file XhprofData.php.
References $data, $parent, and(), list, and splitKey().
Referenced by __construct().
|
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'].
string | $key |
Definition at line 113 of file XhprofData.php.
References and().
Referenced by getCompleteMetrics(), getInclusiveMetrics(), pruneData(), XhprofDataTest\testCriticalPath(), and XhprofDataTest\testSplitKey().
|
protected |
Per-function inclusive and exclusive data.
Definition at line 54 of file XhprofData.php.
Referenced by getCompleteMetrics().
|
protected |
Definition at line 36 of file XhprofData.php.
Referenced by __construct().
|
protected |
Hierarchical profiling data returned by xhprof.
Definition at line 42 of file XhprofData.php.
Referenced by getRawData().
|
protected |
Per-function inclusive data.
Definition at line 48 of file XhprofData.php.
Referenced by getInclusiveMetrics().