From: Tim Starling Date: Sat, 18 Nov 2006 05:17:25 +0000 (+0000) Subject: Add the ability to change the profile ID for UDP profiling at runtime X-Git-Tag: 1.31.0-rc.0~55155 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=fd55bb53dbf8c4b96727d1039ce813a397f98786;p=lhc%2Fweb%2Fwiklou.git Add the ability to change the profile ID for UDP profiling at runtime --- diff --git a/includes/ProfilerSimple.php b/includes/ProfilerSimple.php index d5bdaf94dd..2d0d01ba1c 100644 --- a/includes/ProfilerSimple.php +++ b/includes/ProfilerSimple.php @@ -12,6 +12,7 @@ require_once(dirname(__FILE__).'/Profiler.php'); class ProfilerSimple extends Profiler { var $mMinimumTime = 0; + var $mProfileID = false; function ProfilerSimple() { global $wgRequestTime,$wgRUstart; @@ -39,6 +40,18 @@ class ProfilerSimple extends Profiler { $this->mMinimumTime = $min; } + function setProfileID( $id ) { + $this->mProfileID = $id; + } + + function getProfileID() { + if ( $this->mProfileID === false ) { + return wfWikiID(); + } else { + return $this->mProfileID; + } + } + function profileIn($functionname) { global $wgDebugFunctionEntry; if ($wgDebugFunctionEntry) { diff --git a/includes/ProfilerSimpleUDP.php b/includes/ProfilerSimpleUDP.php index e04905129d..a8527c3891 100644 --- a/includes/ProfilerSimpleUDP.php +++ b/includes/ProfilerSimpleUDP.php @@ -21,7 +21,7 @@ class ProfilerSimpleUDP extends ProfilerSimple { $plength=0; $packet=""; foreach ($this->mCollated as $entry=>$pfdata) { - $pfline=sprintf ("%s %s %d %f %f %f %f %s\n", wfWikiID(),"-",$pfdata['count'], + $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(""); */