64 $this->mWorkStack[] =
array( $inName, count( $this->mWorkStack ),
88 list( $inName, $inCount, $inWall, $inCpu ) = array_pop( $this->mWorkStack );
92 if ( $inName !== $outName ) {
93 $this->
debugGroup(
'ProfilerUnbalanced', json_encode(
array( $inName, $outName ) ) );
97 $elapsedCpu = $this->
getTime(
'cpu' ) - $inCpu;
98 $elapsedWall = $this->
getTime() - $inWall;
99 $this->
updateEntry( $outName, $elapsedCpu, $elapsedWall );
113 if ( !isset( $this->mCollated[
$name] ) ) {
115 'cpu' => $elapsedCpu,
116 'wall' => $elapsedWall,
122 $entry = &$this->mCollated[
$name];
126 if ( $entry[
'count'] === 1 ) {
128 $cpu->push( $entry[
'cpu'] );
129 $entry[
'cpu'] = $cpu;
132 $wall->push( $entry[
'wall'] );
133 $entry[
'wall'] = $wall;
137 $entry[
'cpu']->push( $elapsedCpu );
138 $entry[
'wall']->push( $elapsedWall );
150 global $wgUDPProfilerHost, $wgUDPProfilerPort;
154 $sock = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP );
155 socket_connect( $sock, $wgUDPProfilerHost, $wgUDPProfilerPort );
158 foreach ( $this->mCollated
as $name => $entry ) {
160 $cpu = $entry[
'cpu'];
161 $wall = $entry[
'wall'];
164 $data =
array( self::TYPE_SINGLE,
$name, $cpu, $wall );
167 $cpu->m1, $cpu->m2, $cpu->min, $cpu->max,
168 $wall->m1, $wall->m2, $wall->min, $wall->max );
172 $length = strlen( $encoded );
178 if ( $length + $bufferLength > 1450 ) {
179 socket_send( $sock, $buffer, $bufferLength, 0 );
184 $bufferLength += $length;
186 if ( $bufferLength !== 0 ) {
187 socket_send( $sock, $buffer, $bufferLength, 0 );