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