40 [
'main()', [
null,
'main()' ] ],
41 [
'foo==>bar', [
'foo',
'bar' ] ],
42 [
'bar@1==>bar@2', [
'bar@1',
'bar@2' ] ],
43 [
'foo==>bar==>baz', [
'foo',
'bar==>baz' ] ],
44 [
'==>bar', [
'',
'bar' ] ],
54 'include' => [
'main()' ],
56 $raw = $xhprofData->getRawData();
57 $this->assertArrayHasKey(
'main()', $raw );
58 $this->assertArrayHasKey(
'main()==>foo', $raw );
59 $this->assertArrayHasKey(
'main()==>xhprof_disable', $raw );
60 $this->assertSame( 3,
count( $raw ) );
84 'variance' =>
'numeric',
85 'percent' =>
'numeric',
89 $metrics = $xhprofData->getInclusiveMetrics();
91 foreach ( $metrics
as $name => $metric ) {
94 foreach ( $metricStruct
as $key =>
$type ) {
95 if (
$type ===
'array' ) {
97 if (
$name ===
'main()' ) {
98 $this->assertEquals( 100, $metric[$key][
'percent'] );
121 'subcalls' =>
'array',
123 $statsMetrics = [
'wt',
'cpu',
'mu',
'pmu' ];
125 'total' =>
'numeric',
129 'variance' =>
'numeric',
130 'percent' =>
'numeric',
131 'exclusive' =>
'numeric',
135 $metrics = $xhprofData->getCompleteMetrics();
137 foreach ( $metrics
as $name => $metric ) {
140 foreach ( $metricStruct
as $key =>
$type ) {
141 if ( in_array( $key, $statsMetrics ) ) {
143 $statStruct, $metric[$key], $key
145 $this->assertLessThanOrEqual(
146 $metric[$key][
'total'], $metric[$key][
'exclusive']
160 $this->assertSame( [], $xhprofData->getCallers(
'main()' ) );
161 $this->assertSame( [
'foo',
'xhprof_disable' ],
162 $xhprofData->getCallees(
'main()' )
164 $this->assertSame( [
'main()' ],
165 $xhprofData->getCallers(
'foo' )
167 $this->assertSame( [], $xhprofData->getCallees(
'strlen' ) );
176 $path = $xhprofData->getCriticalPath();
181 $this->assertSame(
$last, $func );
184 $this->assertSame(
$last,
'bar@1' );
245 'main()==>xhprof_disable' => [
270 $this->assertInternalType(
'array', $actual, $label );
271 $this->assertCount(
count( $struct ), $actual, $label );
272 foreach ( $struct
as $key =>
$type ) {
273 $this->assertArrayHasKey( $key, $actual );
274 $this->assertInternalType(
$type, $actual[$key] );