36 global $wgUDPProfilerHost, $wgUDPProfilerPort, $wgUDPProfilerFormatString;
40 if ( isset( $this->mCollated[
'-total'] ) && $this->mCollated[
'-total'][
'real'] < $this->mMinimumTime ) {
41 # Less than minimum, ignore
45 if ( !function_exists(
'socket_create' ) ) {
46 # Sockets are not enabled
50 $sock = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP );
53 foreach ( $this->mCollated
as $entry => $pfdata ) {
54 if ( !isset( $pfdata[
'count'] )
55 || !isset( $pfdata[
'cpu'] )
56 || !isset( $pfdata[
'cpu_sq'] )
57 || !isset( $pfdata[
'real'] )
58 || !isset( $pfdata[
'real_sq'] ) ) {
61 $pfline = sprintf( $wgUDPProfilerFormatString, $this->
getProfileID(), $pfdata[
'count'],
62 $pfdata[
'cpu'], $pfdata[
'cpu_sq'], $pfdata[
'real'], $pfdata[
'real_sq'], $entry );
63 $length = strlen( $pfline );
65 if ( $length + $plength > 1400 ) {
66 socket_sendto( $sock, $packet, $plength, 0, $wgUDPProfilerHost, $wgUDPProfilerPort );
73 socket_sendto( $sock, $packet, $plength, 0x100, $wgUDPProfilerHost, $wgUDPProfilerPort );