MediaWiki  REL1_19
bench_HTTP_HTTPS.php
Go to the documentation of this file.
00001 <?php
00025 require_once( dirname( __FILE__ ) . '/Benchmarker.php' );
00026 class bench_HTTP_HTTPS extends Benchmarker {
00027 
00028         public function __construct() {
00029                 parent::__construct();
00030                 $this->mDescription = "Benchmark HTTP request vs HTTPS request.";
00031         }
00032 
00033         public function execute() {
00034                 $this->bench( array(
00035                         array( 'function' => array( $this, 'getHTTP' ) ),
00036                         array( 'function' => array( $this, 'getHTTPS' ) ),
00037                 ));
00038                 print $this->getFormattedResults();
00039         }
00040 
00041         static function doRequest( $proto ) {
00042                 Http::get( "$proto://localhost/" );
00043         }
00044 
00045         // bench function 1
00046         function getHTTP() {
00047                 $this->doRequest( 'http' );
00048         }
00049 
00050         // bench function 2
00051         function getHTTPS() {
00052                 $this->doRequest( 'https' );
00053         }
00054 }
00055 
00056 $maintClass = 'bench_HTTP_HTTPS';
00057 require_once( RUN_MAINTENANCE_IF_MAIN );