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