From e71e92b67e2eafb47e734de07587279c96430d8b Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 17 Aug 2005 20:04:39 +0000 Subject: [PATCH] Committing live hacks: additional profiling points --- includes/Image.php | 17 ++++++++++++++--- thumb.php | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/includes/Image.php b/includes/Image.php index a741aabde4..18449a1d97 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -915,6 +915,9 @@ class Image function renderThumb( $width, $useScript = true ) { global $wgUseSquid, $wgInternalServer; global $wgThumbnailScriptPath, $wgSharedThumbnailScriptPath; + + $fname = 'Image::renderThumb'; + wfProfileIn( $fname ); $width = intval( $width ); @@ -922,18 +925,22 @@ class Image if ( ! $this->exists() ) { # If there is no image, there will be no thumbnail + wfProfileOut( $fname ); return null; } # Sanity check $width if( $width <= 0 || $this->width <= 0) { # BZZZT + wfProfileOut( $fname ); return null; } if( $width >= $this->width && !$this->mustRender() ) { # Don't make an image bigger than the source - return new ThumbnailImage( $this->getViewURL(), $this->getWidth(), $this->getHeight() ); + $thumb = new ThumbnailImage( $this->getViewURL(), $this->getWidth(), $this->getHeight() ); + wfProfileOut( $fname ); + return $thumb; } $height = floor( $this->height * ( $width/$this->width ) ); @@ -941,7 +948,9 @@ class Image list( $isScriptUrl, $url ) = $this->thumbUrl( $width ); if ( $isScriptUrl && $useScript ) { // Use thumb.php to render the image - return new ThumbnailImage( $url, $width, $height ); + $thumb = new ThumbnailImage( $url, $width, $height ); + wfProfileOut( $fname ); + return $thumb; } $thumbName = $this->thumbName( $width, $this->fromSharedDirectory ); @@ -976,7 +985,9 @@ class Image } } - return new ThumbnailImage( $url, $width, $height, $thumbPath ); + $thumb = new ThumbnailImage( $url, $width, $height, $thumbPath ); + wfProfileOut( $fname ); + return $thumb; } // END OF function renderThumb /** diff --git a/thumb.php b/thumb.php index ff84d89468..0183c3fea1 100644 --- a/thumb.php +++ b/thumb.php @@ -51,6 +51,7 @@ if ( file_exists( $thumbPath ) && filemtime( $thumbPath ) >= filemtime( $imagePa // OK, no valid thumbnail, time to get out the heavy machinery require_once( 'Setup.php' ); +wfProfileIn( 'thumb.php' ); $img = Image::newFromName( $fileName ); if ( $img ) { @@ -72,5 +73,7 @@ if ( $thumb && $thumb->path ) { "; } +wfProfileOut( 'thumb.php' ); + ?> -- 2.20.1