27 use MediaWikiCoversValidator;
39 [
'main()', [
null,
'main()' ] ],
40 [
'foo==>bar', [
'foo',
'bar' ] ],
41 [
'bar@1==>bar@2', [
'bar@1',
'bar@2' ] ],
42 [
'foo==>bar==>baz', [
'foo',
'bar==>baz' ] ],
43 [
'==>bar', [
'',
'bar' ] ],
53 'include' => [
'main()' ],
55 $raw = $xhprofData->getRawData();
56 $this->assertArrayHasKey(
'main()', $raw );
57 $this->assertArrayHasKey(
'main()==>foo', $raw );
58 $this->assertArrayHasKey(
'main()==>xhprof_disable', $raw );
59 $this->assertSame( 3, count( $raw ) );
83 'variance' =>
'numeric',
84 'percent' =>
'numeric',
88 $metrics = $xhprofData->getInclusiveMetrics();
90 foreach ( $metrics as $name => $metric ) {
93 foreach ( $metricStruct as $key =>
$type ) {
94 if (
$type ===
'array' ) {
96 if ( $name ===
'main()' ) {
97 $this->assertEquals( 100, $metric[$key][
'percent'] );
120 'subcalls' =>
'array',
122 $statsMetrics = [
'wt',
'cpu',
'mu',
'pmu' ];
124 'total' =>
'numeric',
128 'variance' =>
'numeric',
129 'percent' =>
'numeric',
130 'exclusive' =>
'numeric',
134 $metrics = $xhprofData->getCompleteMetrics();
136 foreach ( $metrics as $name => $metric ) {
139 foreach ( $metricStruct as $key =>
$type ) {
140 if ( in_array( $key, $statsMetrics ) ) {
142 $statStruct, $metric[$key], $key
144 $this->assertLessThanOrEqual(
145 $metric[$key][
'total'], $metric[$key][
'exclusive']
158 $this->assertSame( [], $xhprofData->getCallers(
'main()' ) );
159 $this->assertSame( [
'foo',
'xhprof_disable' ],
160 $xhprofData->getCallees(
'main()' )
162 $this->assertSame( [
'main()' ],
163 $xhprofData->getCallers(
'foo' )
165 $this->assertSame( [], $xhprofData->getCallees(
'strlen' ) );
173 $path = $xhprofData->getCriticalPath();
176 foreach ( $path as $key =>
$value ) {
178 $this->assertSame(
$last, $func );
181 $this->assertSame(
$last,
'bar@1' );
242 'main()==>xhprof_disable' => [
267 $this->assertInternalType(
'array', $actual, $label );
268 $this->assertCount( count( $struct ), $actual, $label );
269 foreach ( $struct as $key =>
$type ) {
270 $this->assertArrayHasKey( $key, $actual );
271 $this->assertInternalType(
$type, $actual[$key] );
testEdges()
XhprofData::getCallers XhprofData::getCallees.
getXhprofDataFixture(array $opts=[])
Get an Xhprof instance that has been primed with a set of known testing data.
testCriticalPath()
XhprofData::getCriticalPath.
testSplitKey( $key, $expect)
XhprofData::splitKey provideSplitKey.
testInclude()
XhprofData::pruneData.
assertArrayStructure( $struct, $actual, $label=null)
Assert that the given array has the described structure.
testInclusiveMetricsStructure()
Validate the structure of data returned by Xhprof::getInclusiveMetrics().
testCompleteMetricsStructure()
Validate the structure of data returned by Xhprof::getCompleteMetrics().
Convenience class for working with XHProf profiling data https://github.com/phacility/xhprof.
static splitKey( $key)
Convert an xhprof data key into an array of ['parent', 'child'] function names.
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))