MediaWiki REL1_34
bench_HTTP_HTTPS.php
Go to the documentation of this file.
1<?php
28
29require_once __DIR__ . '/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
54 // bench function 1
55 protected function getHTTP() {
56 $this->doRequest( 'http' );
57 }
58
59 // bench function 2
60 protected function getHTTPS() {
61 $this->doRequest( 'https' );
62 }
63}
64
65$maintClass = BenchHttpHttps::class;
66require_once RUN_MAINTENANCE_IF_MAIN;
const RUN_MAINTENANCE_IF_MAIN
Maintenance script that benchmarks HTTP request vs HTTPS request.
__construct()
Default constructor.
execute()
Do the actual work.
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.