MediaWiki REL1_30
bench_HTTP_HTTPS.php
Go to the documentation of this file.
1<?php
27require_once __DIR__ . '/Benchmarker.php';
28
35 public function __construct() {
36 parent::__construct();
37 $this->addDescription( 'Benchmark HTTP request vs HTTPS request.' );
38 }
39
40 public function execute() {
41 $this->bench( [
42 [ 'function' => [ $this, 'getHTTP' ] ],
43 [ 'function' => [ $this, 'getHTTPS' ] ],
44 ] );
45 }
46
47 private function doRequest( $proto ) {
48 Http::get( "$proto://localhost/", [], __METHOD__ );
49 }
50
51 // bench function 1
52 protected function getHTTP() {
53 $this->doRequest( 'http' );
54 }
55
56 // bench function 2
57 protected function getHTTPS() {
58 $this->doRequest( 'https' );
59 }
60}
61
62$maintClass = 'BenchHttpHttps';
63require_once 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.
require_once RUN_MAINTENANCE_IF_MAIN