Made profileIn/profileOut methods a no-op
Change-Id: I781f62be9747bb41af6faad6fbe265414fb77669
This commit is contained in:
parent
69998a7e0d
commit
4236b9beb6
5 changed files with 4 additions and 78 deletions
|
|
@ -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 ) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue