From 4236b9beb63bffbd3d60d482b99913399ab4992d Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 8 Jan 2015 01:54:51 -0800 Subject: [PATCH] Made profileIn/profileOut methods a no-op Change-Id: I781f62be9747bb41af6faad6fbe265414fb77669 --- includes/profiler/ProfileSection.php | 24 ++---------------------- includes/profiler/Profiler.php | 14 -------------- includes/profiler/ProfilerFunctions.php | 16 ++-------------- includes/profiler/ProfilerStub.php | 6 ------ includes/profiler/ProfilerXhprof.php | 22 ---------------------- 5 files changed, 4 insertions(+), 78 deletions(-) diff --git a/includes/profiler/ProfileSection.php b/includes/profiler/ProfileSection.php index ca80ebcb0b..68ef668089 100644 --- a/includes/profiler/ProfileSection.php +++ b/includes/profiler/ProfileSection.php @@ -25,13 +25,9 @@ * Class for handling function-scope profiling * * @since 1.22 + * @deprecated 1.25 No-op now */ class ProfileSection { - /** @var string $name Method name */ - protected $name; - /** @var boolean $enabled Is profiling enabled? */ - protected $enabled = false; - /** * Begin profiling of a function and return an object that ends profiling * of the function when that object leaves scope. As long as the object is @@ -43,21 +39,5 @@ class ProfileSection { * * @param string $name Name of the function to profile */ - public function __construct( $name ) { - $this->name = $name; - // Use Profiler member variable directly to reduce overhead - if ( Profiler::$__instance === null ) { - Profiler::instance(); - } - if ( !( Profiler::$__instance instanceof ProfilerStub ) ) { - $this->enabled = true; - Profiler::$__instance->profileIn( $this->name ); - } - } - - function __destruct() { - if ( $this->enabled ) { - Profiler::$__instance->profileOut( $this->name ); - } - } + public function __construct( $name ) {} } diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php index 667a9e2206..6e1278ff1f 100644 --- a/includes/profiler/Profiler.php +++ b/includes/profiler/Profiler.php @@ -118,20 +118,6 @@ abstract class Profiler { } } - /** - * Called by wfProfieIn() - * - * @param string $functionname - */ - abstract public function profileIn( $functionname ); - - /** - * Called by wfProfieOut() - * - * @param string $functionname - */ - abstract public function profileOut( $functionname ); - /** * Mark the start of a custom profiling frame (e.g. DB queries). * The frame ends when the result of this method falls out of scope. diff --git a/includes/profiler/ProfilerFunctions.php b/includes/profiler/ProfilerFunctions.php index a0d594309f..4984e77d1b 100644 --- a/includes/profiler/ProfilerFunctions.php +++ b/includes/profiler/ProfilerFunctions.php @@ -42,27 +42,15 @@ function wfGetRusage() { /** * Begin profiling of a function * @param string $functionname Name of the function we will profile + * @deprecated 1.25 */ function wfProfileIn( $functionname ) { - // Use Profiler member variable directly to reduce overhead - if ( Profiler::$__instance === null ) { - Profiler::instance(); - } - if ( !( Profiler::$__instance instanceof ProfilerStub ) ) { - Profiler::$__instance->profileIn( $functionname ); - } } /** * Stop profiling of a function * @param string $functionname Name of the function we have profiled + * @deprecated 1.25 */ function wfProfileOut( $functionname = 'missing' ) { - // Use Profiler member variable directly to reduce overhead - if ( Profiler::$__instance === null ) { - Profiler::instance(); - } - if ( !( Profiler::$__instance instanceof ProfilerStub ) ) { - Profiler::$__instance->profileOut( $functionname ); - } } diff --git a/includes/profiler/ProfilerStub.php b/includes/profiler/ProfilerStub.php index 1d77cc0fb5..5580f943d8 100644 --- a/includes/profiler/ProfilerStub.php +++ b/includes/profiler/ProfilerStub.php @@ -27,12 +27,6 @@ * @ingroup Profiler */ class ProfilerStub extends Profiler { - public function profileIn( $fn ) { - } - - public function profileOut( $fn ) { - } - public function scopedProfileIn( $section ) { return new ScopedCallback( null ); // no-op } diff --git a/includes/profiler/ProfilerXhprof.php b/includes/profiler/ProfilerXhprof.php index 64d2de71be..847bbe5d17 100644 --- a/includes/profiler/ProfilerXhprof.php +++ b/includes/profiler/ProfilerXhprof.php @@ -77,28 +77,6 @@ class ProfilerXhprof extends Profiler { $this->sprofiler = new SectionProfiler(); } - /** - * No-op for xhprof profiling. - * - * Use the 'include' configuration key instead if you need to constrain - * the functions that are profiled. - * - * @param string $functionname - */ - public function profileIn( $functionname ) { - } - - /** - * No-op for xhprof profiling. - * - * Use the 'include' configuration key instead if you need to constrain - * the functions that are profiled. - * - * @param string $functionname - */ - public function profileOut( $functionname ) { - } - public function scopedProfileIn( $section ) { return $this->sprofiler->scopedProfileIn( $section ); } -- 2.20.1