From: Domas Mituzas Date: Mon, 26 Dec 2005 10:13:21 +0000 (+0000) Subject: UDP extension for ProfilerSimple, works together with 'udpprofile' daemon X-Git-Tag: 1.6.0~882 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=d4265580de6ada654438df5d58e17f243284b892;p=lhc%2Fweb%2Fwiklou.git UDP extension for ProfilerSimple, works together with 'udpprofile' daemon --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 0b9420067d..6e79fbcb02 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1057,6 +1057,10 @@ $wgProfileCallTree = false; /** If not empty, specifies profiler type to load */ $wgProfilerType = ''; +/** Settings for UDP profiler */ +$wgUDPProfilerHost = '127.0.0.1'; +$wgUDPProfilerPort = '3811'; + /** Detects non-matching wfProfileIn/wfProfileOut calls */ $wgDebugProfiling = false; /** Output debug message on every wfProfileIn/wfProfileOut */ diff --git a/includes/ProfilerSimpleUDP.php b/includes/ProfilerSimpleUDP.php new file mode 100644 index 0000000000..bc6ca98312 --- /dev/null +++ b/includes/ProfilerSimpleUDP.php @@ -0,0 +1,34 @@ +mCollated as $entry=>$pfdata) { + $pfline=sprintf ("%s %s %d %f %f %f %f %s\n", $wgDBname,"-",$pfdata['count'], + $pfdata['cpu'],$pfdata['cpu_sq'],$pfdata['real'],$pfdata['real_sq'],$entry); + $length=strlen($pfline); + /* printf(""); */ + 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); + } +} +?>