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();
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] );