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']
159 $this->assertSame( [], $xhprofData->getCallers(
'main()' ) );
160 $this->assertSame( [
'foo',
'xhprof_disable' ],
161 $xhprofData->getCallees(
'main()' )
163 $this->assertSame( [
'main()' ],
164 $xhprofData->getCallers(
'foo' )
166 $this->assertSame( [], $xhprofData->getCallees(
'strlen' ) );
175 $path = $xhprofData->getCriticalPath();
180 $this->assertSame(
$last, $func );
183 $this->assertSame(
$last,
'bar@1' );
244 'main()==>xhprof_disable' => [
269 $this->assertInternalType(
'array', $actual, $label );
270 $this->assertCount(
count( $struct ), $actual, $label );
271 foreach ( $struct
as $key =>
$type ) {
272 $this->assertArrayHasKey( $key, $actual );
273 $this->assertInternalType(
$type, $actual[$key] );