7 require_once(dirname(__FILE__
).'/ProfilerSimple.php');
10 * ProfilerSimpleUDP class, that sends out messages for 'udpprofile' daemon
11 * (the one from mediawiki/trunk/udpprofile SVN )
14 class ProfilerSimpleUDP
extends ProfilerSimple
{
15 function getFunctionReport() {
16 global $wgUDPProfilerHost, $wgUDPProfilerPort;
18 if ( $this->mCollated
['-total']['real'] < $this->mMinimumTime
) {
19 # Less than minimum, ignore
23 $sock = socket_create(AF_INET
, SOCK_DGRAM
, SOL_UDP
);
26 foreach ($this->mCollated
as $entry=>$pfdata) {
27 $pfline=sprintf ("%s %s %d %f %f %f %f %s\n", $this->getProfileID(),"-",$pfdata['count'],
28 $pfdata['cpu'],$pfdata['cpu_sq'],$pfdata['real'],$pfdata['real_sq'],$entry);
29 $length=strlen($pfline);
30 /* printf("<!-- $pfline -->"); */
31 if ($length+
$plength>1400) {
32 socket_sendto($sock,$packet,$plength,0,$wgUDPProfilerHost,$wgUDPProfilerPort);
39 socket_sendto($sock,$packet,$plength,0x100,$wgUDPProfilerHost,$wgUDPProfilerPort);