* (bug 10117) Special:Wantedpages doesn't handle invalid titles in result - now print...
[lhc/web/wiklou.git] / includes / ProfilerSimpleUDP.php
1 <?php
2
3 require_once(dirname(__FILE__).'/Profiler.php');
4 require_once(dirname(__FILE__).'/ProfilerSimple.php');
5
6 /**
7 * ProfilerSimpleUDP class, that sends out messages for 'udpprofile' daemon
8 * (the one from mediawiki/trunk/udpprofile SVN )
9 * @addtogroup Profiler
10 */
11 class ProfilerSimpleUDP extends ProfilerSimple {
12 function getFunctionReport() {
13 global $wgUDPProfilerHost;
14 global $wgUDPProfilerPort;
15
16 if ( $this->mCollated['-total']['real'] < $this->mMinimumTime ) {
17 # Less than minimum, ignore
18 return;
19 }
20
21 $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
22 $plength=0;
23 $packet="";
24 foreach ($this->mCollated as $entry=>$pfdata) {
25 $pfline=sprintf ("%s %s %d %f %f %f %f %s\n", $this->getProfileID(),"-",$pfdata['count'],
26 $pfdata['cpu'],$pfdata['cpu_sq'],$pfdata['real'],$pfdata['real_sq'],$entry);
27 $length=strlen($pfline);
28 /* printf("<!-- $pfline -->"); */
29 if ($length+$plength>1400) {
30 socket_sendto($sock,$packet,$plength,0,$wgUDPProfilerHost,$wgUDPProfilerPort);
31 $packet="";
32 $plength=0;
33 }
34 $packet.=$pfline;
35 $plength+=$length;
36 }
37 socket_sendto($sock,$packet,$plength,0x100,$wgUDPProfilerHost,$wgUDPProfilerPort);
38 }
39 }
40 ?>