From fd55bb53dbf8c4b96727d1039ce813a397f98786 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 18 Nov 2006 05:17:25 +0000 Subject: [PATCH] Add the ability to change the profile ID for UDP profiling at runtime --- includes/ProfilerSimple.php | 13 +++++++++++++ includes/ProfilerSimpleUDP.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) 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(""); */ -- 2.20.1