2 /* ProfilerSimpleUDP class, that sends out messages for 'udpprofile' daemon
3 (the one from wikipedia/udpprofile CVS )
6 require_once(dirname(__FILE__
).'/Profiler.php');
7 require_once(dirname(__FILE__
).'/ProfilerSimple.php');
9 class ProfilerSimpleUDP
extends ProfilerSimple
{
10 function getFunctionReport() {
11 global $wgUDPProfilerHost;
12 global $wgUDPProfilerPort;
15 $sock = socket_create(AF_INET
, SOCK_DGRAM
, SOL_UDP
);
18 foreach ($this->mCollated
as $entry=>$pfdata) {
19 $pfline=sprintf ("%s %s %d %f %f %f %f %s\n", $wgDBname,"-",$pfdata['count'],
20 $pfdata['cpu'],$pfdata['cpu_sq'],$pfdata['real'],$pfdata['real_sq'],$entry);
21 $length=strlen($pfline);
22 /* printf("<!-- $pfline -->"); */
23 if ($length+
$plength>1400) {
24 socket_sendto($sock,$packet,$plength,0,$wgUDPProfilerHost,$wgUDPProfilerPort);
31 socket_sendto($sock,$packet,$plength,0x100,$wgUDPProfilerHost,$wgUDPProfilerPort);