Remove obvious function-level profiling
Change-Id: I41d48da124e38c46ce71aa9d3b756096a424df1c
This commit is contained in:
parent
a24f16d79e
commit
0404113641
|
@ -97,7 +97,6 @@ class MathHooks {
|
|||
return '';
|
||||
}
|
||||
|
||||
wfProfileIn( __METHOD__ );
|
||||
$mode = (int)$parser->getUser()->getOption( 'math' );
|
||||
|
||||
// Indicate that this page uses math.
|
||||
|
@ -139,7 +138,6 @@ class MathHooks {
|
|||
}
|
||||
// Writes cache if rendering was successful
|
||||
$renderer->writeCache();
|
||||
wfProfileOut( __METHOD__ );
|
||||
|
||||
return array( $renderedMath, "markerType" => 'nowiki' );
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ class MathLaTeXML extends MathMathML {
|
|||
*/
|
||||
protected function doRender() {
|
||||
global $wgMathDebug;
|
||||
wfProfileIn( __METHOD__ );
|
||||
|
||||
if ( trim( $this->getTex() ) === '' ) {
|
||||
wfDebugLog( "Math", "Rendering was requested, but no TeX string is specified." );
|
||||
$this->lastError = $this->getError( 'math_empty_tex' );
|
||||
|
@ -127,7 +127,6 @@ class MathLaTeXML extends MathMathML {
|
|||
wfDebugLog( "Math", "\nLaTeXML InvalidMathML:"
|
||||
. var_export( array( 'post' => $post, 'host' => $host
|
||||
, 'result' => $res ), true ) . "\n\n" );
|
||||
wfProfileOut( __METHOD__ );
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
@ -135,12 +134,10 @@ class MathLaTeXML extends MathMathML {
|
|||
wfDebugLog( "Math", "\nLaTeXML InvalidJSON:"
|
||||
. var_export( array( 'post' => $post, 'host' => $host
|
||||
, 'res' => $res ), true ) . "\n\n" );
|
||||
wfProfileOut( __METHOD__ );
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Error message has already been set.
|
||||
wfProfileOut( __METHOD__ );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,15 +82,12 @@ class MathMathML extends MathRenderer {
|
|||
* @see MathRenderer::render()
|
||||
*/
|
||||
public function render( $forceReRendering = false ) {
|
||||
wfProfileIn( __METHOD__ );
|
||||
if ( $forceReRendering ) {
|
||||
$this->setPurge( true );
|
||||
}
|
||||
if ( $this->renderingRequired() ) {
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $this->doRender( );
|
||||
return $this->doRender();
|
||||
}
|
||||
wfProfileOut( __METHOD__ );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -143,7 +140,6 @@ class MathMathML extends MathRenderer {
|
|||
// TODO: Change the timeout mechanism.
|
||||
global $wgMathLaTeXMLTimeout;
|
||||
|
||||
wfProfileIn( __METHOD__ );
|
||||
$error = '';
|
||||
$res = null;
|
||||
if ( !$host ) {
|
||||
|
@ -159,7 +155,6 @@ class MathMathML extends MathRenderer {
|
|||
$status = $req->execute();
|
||||
if ( $status->isGood() ) {
|
||||
$res = $req->getContent();
|
||||
wfProfileOut( __METHOD__ );
|
||||
return true;
|
||||
} else {
|
||||
if ( $status->hasMessage( 'http-timed-out' ) ) {
|
||||
|
@ -176,7 +171,6 @@ class MathMathML extends MathRenderer {
|
|||
. var_export( array( 'post' => $post, 'host' => $host
|
||||
, 'errormsg' => $errormsg ), true ) . "\n\n" );
|
||||
}
|
||||
wfProfileOut( __METHOD__ );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -259,7 +259,6 @@ abstract class MathRenderer {
|
|||
* @return boolean true if read successfully, false otherwise
|
||||
*/
|
||||
public function readFromDatabase() {
|
||||
wfProfileIn( __METHOD__ );
|
||||
/** @var DatabaseBase */
|
||||
$dbr = wfGetDB( DB_SLAVE );
|
||||
/** @var ResultWrapper */
|
||||
|
@ -270,12 +269,10 @@ abstract class MathRenderer {
|
|||
if ( $rpage !== false ) {
|
||||
$this->initializeFromDatabaseRow( $rpage );
|
||||
$this->storedInDatabase = true;
|
||||
wfProfileOut( __METHOD__ );
|
||||
return true;
|
||||
} else {
|
||||
# Missing from the database and/or the render cache
|
||||
$this->storedInDatabase = false;
|
||||
wfProfileOut( __METHOD__ );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,11 +174,9 @@ class MathTexvc extends MathRenderer {
|
|||
public function callTexvc() {
|
||||
global $wgTexvc, $wgTexvcBackgroundColor, $wgHooks;
|
||||
|
||||
wfProfileIn( __METHOD__ );
|
||||
$tmpDir = wfTempDir();
|
||||
if ( !is_executable( $wgTexvc ) ) {
|
||||
wfDebugLog( 'texvc', "$wgTexvc does not exist or is not executable." );
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $this->getError( 'math_notexvc' );
|
||||
}
|
||||
|
||||
|
@ -204,11 +202,9 @@ class MathTexvc extends MathRenderer {
|
|||
if ( strlen( $contents ) == 0 ) {
|
||||
if ( !file_exists( $tmpDir ) || !is_writable( $tmpDir ) ) {
|
||||
wfDebugLog( 'texvc', "TeX output directory $tmpDir is missing or not writable" );
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $this->getError( 'math_bad_tmpdir' );
|
||||
} else {
|
||||
wfDebugLog( 'texvc', "TeX command '$cmd' returned no output and status code $retval." );
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $this->getError( 'math_unknown_error' );
|
||||
}
|
||||
}
|
||||
|
@ -265,16 +261,12 @@ class MathTexvc extends MathRenderer {
|
|||
wfRunHooks( 'MathAfterTexvc', array( &$this, &$errmsg ) );
|
||||
|
||||
if ( $errmsg ) {
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $errmsg;
|
||||
} elseif ( !preg_match( "/^[a-f0-9]{32}$/", $this->getHash() ) ) {
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $this->getError( 'math_unknown_error' );
|
||||
} elseif ( !file_exists( "$tmpDir/{$this->getHash()}.png" ) ) {
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $this->getError( 'math_image_error' );
|
||||
} elseif ( filesize( "$tmpDir/{$this->getHash()}.png" ) == 0 ) {
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $this->getError( 'math_image_error' );
|
||||
}
|
||||
|
||||
|
@ -283,7 +275,6 @@ class MathTexvc extends MathRenderer {
|
|||
$backend = $this->getBackend();
|
||||
# Create any containers/directories as needed...
|
||||
if ( !$backend->prepare( array( 'dir' => $hashpath ) )->isOK() ) {
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $this->getError( 'math_output_error' );
|
||||
}
|
||||
// Store the file at the final storage path...
|
||||
|
@ -304,7 +295,6 @@ class MathTexvc extends MathRenderer {
|
|||
'ref' => $tempFsFile // keep file alive
|
||||
);
|
||||
|
||||
wfProfileOut( __METHOD__ );
|
||||
return self::MW_TEXVC_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -367,7 +357,6 @@ class MathTexvc extends MathRenderer {
|
|||
public function writeCache() {
|
||||
global $wgUseSquid;
|
||||
|
||||
wfProfileIn( __METHOD__ );
|
||||
$updated = parent::writeCache();
|
||||
// If we're replacing an older version of the image, make sure it's current.
|
||||
if ( $updated && $wgUseSquid ) {
|
||||
|
@ -375,7 +364,7 @@ class MathTexvc extends MathRenderer {
|
|||
$u = new SquidUpdate( $urls );
|
||||
$u->doUpdate();
|
||||
}
|
||||
wfProfileOut( __METHOD__ );
|
||||
|
||||
return $updated;
|
||||
}
|
||||
|
||||
|
@ -387,11 +376,9 @@ class MathTexvc extends MathRenderer {
|
|||
public function readCache() {
|
||||
global $wgMathCheckFiles;
|
||||
|
||||
wfProfileIn( __METHOD__ );
|
||||
if ( $this->isInDatabase() ) {
|
||||
if ( !$wgMathCheckFiles ) {
|
||||
// Short-circuit the file existence & migration checks
|
||||
wfProfileOut( __METHOD__ );
|
||||
return true;
|
||||
}
|
||||
$filename = $this->getHashPath() . "/{$this->getHash()}.png"; // final storage path
|
||||
|
@ -401,12 +388,10 @@ class MathTexvc extends MathRenderer {
|
|||
// Some horrible error corrupted stuff :(
|
||||
$backend->quickDelete( array( 'src' => $filename ) );
|
||||
} else {
|
||||
wfProfileOut( __METHOD__ );
|
||||
return true; // cache hit
|
||||
}
|
||||
}
|
||||
}
|
||||
wfProfileOut( __METHOD__ );
|
||||
return false;
|
||||
}
|
||||
public function getPng() {
|
||||
|
|
Loading…
Reference in New Issue