From 08ea8adc95a4edba0b1f2f13c34f2a57725f1a58 Mon Sep 17 00:00:00 2001 From: Aaron Date: Thu, 16 Aug 2012 18:05:01 -0700 Subject: [PATCH] Adding more file profiling. Change-Id: Id45e082966f1ed6105918c0732b450faf039cd96 --- includes/filebackend/TempFSFile.php | 9 ++++++--- includes/filerepo/file/File.php | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/filebackend/TempFSFile.php b/includes/filebackend/TempFSFile.php index ddc640a6e9..00f1080950 100644 --- a/includes/filebackend/TempFSFile.php +++ b/includes/filebackend/TempFSFile.php @@ -36,12 +36,13 @@ class TempFSFile extends FSFile { /** * Make a new temporary file on the file system. * Temporary files may be purged when the file object falls out of scope. - * + * * @param $prefix string * @param $extension string - * @return TempFSFile|null + * @return TempFSFile|null */ public static function factory( $prefix, $extension = '' ) { + wfProfileIn( __METHOD__ ); $base = wfTempDir() . '/' . $prefix . dechex( mt_rand( 0, 99999999 ) ); $ext = ( $extension != '' ) ? ".{$extension}" : ""; for ( $attempt = 1; true; $attempt++ ) { @@ -54,17 +55,19 @@ class TempFSFile extends FSFile { break; // got it } if ( $attempt >= 15 ) { + wfProfileOut( __METHOD__ ); return null; // give up } } $tmpFile = new self( $path ); $tmpFile->canDelete = true; // safely instantiated + wfProfileOut( __METHOD__ ); return $tmpFile; } /** * Purge this file off the file system - * + * * @return bool Success */ public function purge() { diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 7489862ee3..b18304078c 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -894,7 +894,9 @@ abstract class File { $tmpThumbPath = $tmpFile->getPath(); // path of 0-byte temp file // Actually render the thumbnail... + wfProfileIn( __METHOD__ . '-doTransform' ); $thumb = $this->handler->doTransform( $this, $tmpThumbPath, $thumbUrl, $params ); + wfProfileOut( __METHOD__ . '-doTransform' ); $tmpFile->bind( $thumb ); // keep alive with $thumb if ( !$thumb ) { // bad params? -- 2.20.1