8 * ProfilerSimpleUDP class, that sends out messages for 'udpprofile' daemon
9 * (the one from mediawiki/trunk/udpprofile SVN )
12 class ProfilerSimpleUDP
extends ProfilerSimple
{
13 public function logData() {
14 global $wgUDPProfilerHost, $wgUDPProfilerPort;
18 if ( isset( $this->mCollated
['-total'] ) && $this->mCollated
['-total']['real'] < $this->mMinimumTime
) {
19 # Less than minimum, ignore
23 if ( !MWInit
::functionExists( 'socket_create' ) ) {
24 # Sockets are not enabled
28 $sock = socket_create(AF_INET
, SOCK_DGRAM
, SOL_UDP
);
31 foreach ($this->mCollated
as $entry=>$pfdata) {
32 $pfline=sprintf ("%s %s %d %f %f %f %f %s\n", $this->getProfileID(),"-",$pfdata['count'],
33 $pfdata['cpu'],$pfdata['cpu_sq'],$pfdata['real'],$pfdata['real_sq'],$entry);
34 $length=strlen($pfline);
35 /* printf("<!-- $pfline -->"); */
36 if ($length+
$plength>1400) {
37 socket_sendto($sock,$packet,$plength,0,$wgUDPProfilerHost,$wgUDPProfilerPort);
44 socket_sendto($sock,$packet,$plength,0x100,$wgUDPProfilerHost,$wgUDPProfilerPort);