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;
14 if ( $this->mCollated
['-total']['real'] < $this->mMinimumTime
) {
15 # Less than minimum, ignore
20 $sock = socket_create(AF_INET
, SOCK_DGRAM
, SOL_UDP
);
23 foreach ($this->mCollated
as $entry=>$pfdata) {
24 $pfline=sprintf ("%s %s %d %f %f %f %f %s\n", $this->getProfileID(),"-",$pfdata['count'],
25 $pfdata['cpu'],$pfdata['cpu_sq'],$pfdata['real'],$pfdata['real_sq'],$entry);
26 $length=strlen($pfline);
27 /* printf("<!-- $pfline -->"); */
28 if ($length+
$plength>1400) {
29 socket_sendto($sock,$packet,$plength,0,$wgUDPProfilerHost,$wgUDPProfilerPort);
36 socket_sendto($sock,$packet,$plength,0x100,$wgUDPProfilerHost,$wgUDPProfilerPort);