* 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
*
* @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 ) {}
}
}
}
- /**
- * 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.
/**
* 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 );
- }
}
* @ingroup Profiler
*/
class ProfilerStub extends Profiler {
- public function profileIn( $fn ) {
- }
-
- public function profileOut( $fn ) {
- }
-
public function scopedProfileIn( $section ) {
return new ScopedCallback( null ); // no-op
}
$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 );
}