wiki.techinc.nl/includes/ProfilerSimpleUDP.php
Nick Jenkins 113bb1c772 Documentation tweaks to help documentation systems (Doxygen + PHPDocumentor)
pick up the appropriate tags, and documentation blobs for classes. This is 
the same as per r20769, but with the grouping changes (e.g. removing "@{{") omitted.
Please be advised that more related documentation tweaks may follow later - e.g. 
Doxygen generates a log file of warnings that is 574 Kb in size, when run over 
the just the trunk/phase3 code ... eek! Thankfully, much of that is just 
whining about functions without documentation   ;-)
2007-04-04 05:22:37 +00:00

39 lines
1.1 KiB
PHP

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