svn:eol-style native
authorSam Reed <reedy@users.mediawiki.org>
Sun, 16 Oct 2011 03:32:39 +0000 (03:32 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sun, 16 Oct 2011 03:32:39 +0000 (03:32 +0000)
maintenance/benchmarks/benchmarkHooks.php

index ec11c2f..d614423 100644 (file)
@@ -1,80 +1,80 @@
-<?php\r
-/**\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License along\r
- * with this program; if not, write to the Free Software Foundation, Inc.,\r
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
- * http://www.gnu.org/copyleft/gpl.html\r
- *\r
- * @file\r
- * @ingroup Maintenance\r
- */\r
-\r
-require_once( dirname( __FILE__ ) . '/Benchmarker.php' );\r
-\r
-class BenchmarkHooks extends Benchmarker {\r
-\r
-       public function __construct() {\r
-               parent::__construct();\r
-               $this->mDescription = "Benchmark MediaWiki Hooks.";\r
-       }\r
-\r
-       public function execute() {\r
-               global $wgHooks;\r
-               $wgHooks['Test'] = array();\r
-\r
-               $time = $this->benchHooks();\r
-               $this->output( 'Empty hook: ' . $time . "\n" );\r
-\r
-               $wgHooks['Test'][] = array( $this, 'test' );\r
-               $time = $this->benchHooks();\r
-               $this->output( 'Loaded (one) hook: ' . $time . "\n" );\r
-\r
-               for( $i = 0; $i < 9; $i++ ) {\r
-                       $wgHooks['Test'][] = array( $this, 'test' );\r
-               }\r
-               $time = $this->benchHooks();\r
-               $this->output( 'Loaded (ten) hook: ' . $time . "\n" );\r
-\r
-               for( $i = 0; $i < 90; $i++ ) {\r
-                       $wgHooks['Test'][] = array( $this, 'test' );\r
-               }\r
-               $time = $this->benchHooks();\r
-               $this->output( 'Loaded (one hundred) hook: ' . $time . "\n" );\r
-               $this->output( "\n" );\r
-       }\r
-\r
-       /**\r
-        * @param $trials int\r
-        * @return string\r
-        */\r
-       private function benchHooks( $trials = 10 ) {\r
-               $start = wfTime();\r
-               for ( $i = 0; $i < $trials; $i++ ) {\r
-                       wfRunHooks( 'Test' );\r
-               }\r
-               $delta = wfTime() - $start;\r
-               $pertrial = $delta / $trials;\r
-               return sprintf( "Took %6.2fs",\r
-                       $pertrial );\r
-       }\r
-\r
-       /**\r
-        * @return bool\r
-        */\r
-       public function test() {\r
-               return true;\r
-       }\r
-}\r
-\r
-$maintClass = "BenchmarkHooks";\r
-require_once( RUN_MAINTENANCE_IF_MAIN );\r
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Maintenance
+ */
+
+require_once( dirname( __FILE__ ) . '/Benchmarker.php' );
+
+class BenchmarkHooks extends Benchmarker {
+
+       public function __construct() {
+               parent::__construct();
+               $this->mDescription = "Benchmark MediaWiki Hooks.";
+       }
+
+       public function execute() {
+               global $wgHooks;
+               $wgHooks['Test'] = array();
+
+               $time = $this->benchHooks();
+               $this->output( 'Empty hook: ' . $time . "\n" );
+
+               $wgHooks['Test'][] = array( $this, 'test' );
+               $time = $this->benchHooks();
+               $this->output( 'Loaded (one) hook: ' . $time . "\n" );
+
+               for( $i = 0; $i < 9; $i++ ) {
+                       $wgHooks['Test'][] = array( $this, 'test' );
+               }
+               $time = $this->benchHooks();
+               $this->output( 'Loaded (ten) hook: ' . $time . "\n" );
+
+               for( $i = 0; $i < 90; $i++ ) {
+                       $wgHooks['Test'][] = array( $this, 'test' );
+               }
+               $time = $this->benchHooks();
+               $this->output( 'Loaded (one hundred) hook: ' . $time . "\n" );
+               $this->output( "\n" );
+       }
+
+       /**
+        * @param $trials int
+        * @return string
+        */
+       private function benchHooks( $trials = 10 ) {
+               $start = wfTime();
+               for ( $i = 0; $i < $trials; $i++ ) {
+                       wfRunHooks( 'Test' );
+               }
+               $delta = wfTime() - $start;
+               $pertrial = $delta / $trials;
+               return sprintf( "Took %6.2fs",
+                       $pertrial );
+       }
+
+       /**
+        * @return bool
+        */
+       public function test() {
+               return true;
+       }
+}
+
+$maintClass = "BenchmarkHooks";
+require_once( RUN_MAINTENANCE_IF_MAIN );