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