Made profileIn/profileOut methods a no-op
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 8 Jan 2015 09:54:51 +0000 (01:54 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 8 Jan 2015 09:54:51 +0000 (01:54 -0800)
Change-Id: I781f62be9747bb41af6faad6fbe265414fb77669

includes/profiler/ProfileSection.php
includes/profiler/Profiler.php
includes/profiler/ProfilerFunctions.php
includes/profiler/ProfilerStub.php
includes/profiler/ProfilerXhprof.php

index ca80ebc..68ef668 100644 (file)
  * 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 ) {}
 }
index 667a9e2..6e1278f 100644 (file)
@@ -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.
index a0d5943..4984e77 100644 (file)
@@ -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 );
-       }
 }
index 1d77cc0..5580f94 100644 (file)
  * @ingroup Profiler
  */
 class ProfilerStub extends Profiler {
-       public function profileIn( $fn ) {
-       }
-
-       public function profileOut( $fn ) {
-       }
-
        public function scopedProfileIn( $section ) {
                return new ScopedCallback( null ); // no-op
        }
index 64d2de7..847bbe5 100644 (file)
@@ -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 );
        }