Fixed profiling
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 26 May 2004 12:30:36 +0000 (12:30 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 26 May 2004 12:30:36 +0000 (12:30 +0000)
includes/Parser.php
includes/Profiling.php

index 4404e7d..3a4b666 100644 (file)
@@ -994,6 +994,7 @@ class Parser
                        $trail = $m[3];
                } else { # Invalid form; output directly
                        $s .= $prefix . "[[" . $line ;
+                       wfProfileOut( $fname );
                        return $s;
                }
 
@@ -1032,6 +1033,7 @@ class Parser
                $nt = Title::newFromText( $link );
                if( !$nt ) {
                        $s .= $prefix . "[[" . $line;
+                       wfProfileOut( $fname );
                        return $s;
                }
                $ns = $nt->getNamespace();
@@ -1040,11 +1042,13 @@ class Parser
                        if( $iw && $this->mOptions->getInterwikiMagic() && $nottalk && $wgLang->getLanguageName( $iw ) ) {
                                array_push( $this->mOutput->mLanguageLinks, $nt->getPrefixedText() );
                                $s .= $prefix . $trail ;
+                               wfProfileOut( $fname );
                                return (trim($s) == '')? '': $s;
                        }
                        if( $ns == $image ) {
                                $s .= $prefix . $sk->makeImageLinkObj( $nt, $text ) . $trail;
                                $wgLinkCache->addImageLinkObj( $nt );
+                               wfProfileOut( $fname );
                                return $s;
                        }
                        if ( $ns == $category ) {
@@ -1059,6 +1063,7 @@ class Parser
                                $wgLinkCache->addCategoryLinkObj( $nt, $sortkey );
                                $this->mOutput->mCategoryLinks[] = $t ;
                                $s .= $prefix . $trail ;
+                               wfProfileOut( $fname );
                                return $s ;
                        }
                }
@@ -1066,15 +1071,18 @@ class Parser
                    ( strpos( $link, "#" ) == FALSE ) ) {
                        # Self-links are handled specially; generally de-link and change to bold.
                        $s .= $prefix . $sk->makeSelfLinkObj( $nt, $text, "", $trail );
+                       wfProfileOut( $fname );
                        return $s;
                }
 
                if( $ns == $media ) {
                        $s .= $prefix . $sk->makeMediaLinkObj( $nt, $text ) . $trail;
                        $wgLinkCache->addImageLinkObj( $nt );
+                       wfProfileOut( $fname );
                        return $s;
                } elseif( $ns == $special ) {
                        $s .= $prefix . $sk->makeKnownLinkObj( $nt, $text, "", $trail );
+                       wfProfileOut( $fname );
                        return $s;
                }
                $s .= $sk->makeLinkObj( $nt, $text, "", $trail , $prefix );
@@ -1394,6 +1402,7 @@ class Parser
 
                array_pop( $this->mArgStack );
 
+               wfProfileOut( $fname );
                return $text;
        }
 
index 392ca38..ed58bf0 100755 (executable)
@@ -82,6 +82,7 @@ class Profiler
                if( !count( $this->mStack ) ) {
                        return "No profiling output\n";
                }
+               $this->close();
                $width = 125;
                $format = "%-" . ($width - 28) . "s %6d %6.3f %6.3f %6.3f%%\n";
                $titleFormat = "%-" . ($width - 28) . "s %9s %9s %9s %9s\n";
@@ -173,5 +174,4 @@ class Profiler
 
 $wgProfiler = new Profiler();
 $wgProfiler->profileIn( "-total" );
-
 ?>