29 use MediaWikiCoversValidator;
41 [
'main()', [
null,
'main()' ] ],
42 [
'foo==>bar', [
'foo',
'bar' ] ],
43 [
'bar@1==>bar@2', [
'bar@1',
'bar@2' ] ],
44 [
'foo==>bar==>baz', [
'foo',
'bar==>baz' ] ],
45 [
'==>bar', [
'',
'bar' ] ],
55 'include' => [
'main()' ],
57 $raw = $xhprofData->getRawData();
58 $this->assertArrayHasKey(
'main()', $raw );
59 $this->assertArrayHasKey(
'main()==>foo', $raw );
60 $this->assertArrayHasKey(
'main()==>xhprof_disable', $raw );
61 $this->assertSame( 3, count( $raw ) );
85 'variance' =>
'numeric',
86 'percent' =>
'numeric',
90 $metrics = $xhprofData->getInclusiveMetrics();
92 foreach ( $metrics
as $name => $metric ) {
95 foreach ( $metricStruct
as $key =>
$type ) {
96 if (
$type ===
'array' ) {
98 if (
$name ===
'main()' ) {
99 $this->assertEquals( 100, $metric[$key][
'percent'] );
122 'subcalls' =>
'array',
124 $statsMetrics = [
'wt',
'cpu',
'mu',
'pmu' ];
126 'total' =>
'numeric',
130 'variance' =>
'numeric',
131 'percent' =>
'numeric',
132 'exclusive' =>
'numeric',
136 $metrics = $xhprofData->getCompleteMetrics();
138 foreach ( $metrics
as $name => $metric ) {
141 foreach ( $metricStruct
as $key =>
$type ) {
142 if ( in_array( $key, $statsMetrics ) ) {
144 $statStruct, $metric[$key], $key
146 $this->assertLessThanOrEqual(
147 $metric[$key][
'total'], $metric[$key][
'exclusive']
161 $this->assertSame( [], $xhprofData->getCallers(
'main()' ) );
162 $this->assertSame( [
'foo',
'xhprof_disable' ],
163 $xhprofData->getCallees(
'main()' )
165 $this->assertSame( [
'main()' ],
166 $xhprofData->getCallers(
'foo' )
168 $this->assertSame( [], $xhprofData->getCallees(
'strlen' ) );
177 $path = $xhprofData->getCriticalPath();
182 $this->assertSame(
$last, $func );
185 $this->assertSame(
$last,
'bar@1' );
246 'main()==>xhprof_disable' => [
271 $this->assertInternalType(
'array', $actual, $label );
272 $this->assertCount( count( $struct ), $actual, $label );
273 foreach ( $struct
as $key =>
$type ) {
274 $this->assertArrayHasKey( $key, $actual );
275 $this->assertInternalType(
$type, $actual[$key] );