Index: trunk/phase3/includes/profiler/ProfilerSimpleUDP.php |
— | — | @@ -26,21 +26,28 @@ |
27 | 27 | } |
28 | 28 | |
29 | 29 | $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
30 | | - $plength=0; |
31 | | - $packet=""; |
32 | | - foreach ($this->mCollated as $entry=>$pfdata) { |
33 | | - $pfline=sprintf ("%s %s %d %f %f %f %f %s\n", $this->getProfileID(),"-",$pfdata['count'], |
34 | | - $pfdata['cpu'],$pfdata['cpu_sq'],$pfdata['real'],$pfdata['real_sq'],$entry); |
35 | | - $length=strlen($pfline); |
| 30 | + $plength = 0; |
| 31 | + $packet = ""; |
| 32 | + foreach ( $this->mCollated as $entry => $pfdata ) { |
| 33 | + if( !isset($pfdata['count']) |
| 34 | + || !isset( $pfdata['cpu'] ) |
| 35 | + || !isset( $pfdata['cpu_sq'] ) |
| 36 | + || !isset( $pfdata['real'] ) |
| 37 | + || !isset( $pfdata['real_sq'] ) ) { |
| 38 | + continue; |
| 39 | + } |
| 40 | + $pfline = sprintf( "%s %s %d %f %f %f %f %s\n", $this->getProfileID(), "-", $pfdata['count'], |
| 41 | + $pfdata['cpu'], $pfdata['cpu_sq'], $pfdata['real'], $pfdata['real_sq'], $entry); |
| 42 | + $length = strlen( $pfline ); |
36 | 43 | /* printf("<!-- $pfline -->"); */ |
37 | | - if ($length+$plength>1400) { |
38 | | - socket_sendto($sock,$packet,$plength,0,$wgUDPProfilerHost,$wgUDPProfilerPort); |
39 | | - $packet=""; |
40 | | - $plength=0; |
| 44 | + if ( $length + $plength > 1400 ) { |
| 45 | + socket_sendto( $sock, $packet, $plength, 0, $wgUDPProfilerHost, $wgUDPProfilerPort ); |
| 46 | + $packet = ""; |
| 47 | + $plength = 0; |
41 | 48 | } |
42 | | - $packet.=$pfline; |
43 | | - $plength+=$length; |
| 49 | + $packet .= $pfline; |
| 50 | + $plength += $length; |
44 | 51 | } |
45 | | - socket_sendto($sock,$packet,$plength,0x100,$wgUDPProfilerHost,$wgUDPProfilerPort); |
| 52 | + socket_sendto( $sock, $packet, $plength, 0x100, $wgUDPProfilerHost, $wgUDPProfilerPort ); |
46 | 53 | } |
47 | 54 | } |