MediaWiki REL1_35
bench_HTTP_HTTPS.php
Go to the documentation of this file.
1<?php
28
29require_once __DIR__ . '/../includes/Benchmarker.php';
30
37 public function __construct() {
38 parent::__construct();
39 $this->addDescription( 'Benchmark HTTP request vs HTTPS request.' );
40 }
41
42 public function execute() {
43 $this->bench( [
44 [ 'function' => [ $this, 'getHTTP' ] ],
45 [ 'function' => [ $this, 'getHTTPS' ] ],
46 ] );
47 }
48
49 private function doRequest( $proto ) {
50 MediaWikiServices::getInstance()->getHttpRequestFactory()->
51 get( "$proto://localhost/", [], __METHOD__ );
52 }
53
57 protected function getHTTP() {
58 $this->doRequest( 'http' );
59 }
60
64 protected function getHTTPS() {
65 $this->doRequest( 'https' );
66 }
67}
68
69$maintClass = BenchHttpHttps::class;
70require_once RUN_MAINTENANCE_IF_MAIN;
const RUN_MAINTENANCE_IF_MAIN
Maintenance script that benchmarks HTTP request vs HTTPS request.
__construct()
Default constructor.
getHTTPS()
bench function 2
execute()
Do the actual work.
getHTTP()
bench function 1
Base class for benchmark scripts.
bench(array $benchs)
addDescription( $text)
Set the description text.
MediaWikiServices is the service locator for the application scope of MediaWiki.