Adding more file profiling.
authorAaron <aschulz@wikimedia.org>
Fri, 17 Aug 2012 01:05:01 +0000 (18:05 -0700)
committerAaron <aschulz@wikimedia.org>
Fri, 17 Aug 2012 01:05:01 +0000 (18:05 -0700)
Change-Id: Id45e082966f1ed6105918c0732b450faf039cd96

includes/filebackend/TempFSFile.php
includes/filerepo/file/File.php

index ddc640a..00f1080 100644 (file)
@@ -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() {
index 7489862..b183040 100644 (file)
@@ -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?