diff --git a/base/PerfOptions.php b/base/PerfOptions.php index 59b89c0..4fe0b53 100644 --- a/base/PerfOptions.php +++ b/base/PerfOptions.php @@ -37,6 +37,7 @@ final class PerfOptions { public string $nginx; public bool $skipSanityCheck = false; + public bool $skipWarmUp = false; public bool $skipVersionChecks = false; public bool $skipDatabaseInstall = false; public bool $dumpIsCompressed = true; @@ -144,6 +145,7 @@ public function __construct(Vector $argv) { 'no-time-limit', 'skip-sanity-check', + 'skip-warmup', 'skip-version-checks', 'skip-database-install', 'trace', @@ -216,6 +218,7 @@ public function __construct(Vector $argv) { $this->args = $o; $this->skipSanityCheck = $this->getBool('skip-sanity-check'); + $this->skipWarmUp = $this->getBool('skip-warmup'); $this->skipVersionChecks = $this->getBool('skip-version-checks'); $this->skipDatabaseInstall = $this->getBool('skip-database-install'); $this->noTimeLimit = $this->getBool('no-time-limit'); diff --git a/base/PerfRunner.php b/base/PerfRunner.php index 87087b7..8de0f7f 100644 --- a/base/PerfRunner.php +++ b/base/PerfRunner.php @@ -96,28 +96,36 @@ private static function RunWithOptionsAndEngine( $target->sanityCheck(); } - self::PrintProgress('Starting Siege for single request warmup'); - $siege = new Siege($options, $target, RequestModes::WARMUP); - $siege->start(); - invariant($siege->isRunning(), 'Failed to start siege'); - $siege->wait(); + if (!$options->skipWarmUp) { + self::PrintProgress('Starting Siege for single request warmup'); + $siege = new Siege($options, $target, RequestModes::WARMUP); + $siege->start(); + invariant($siege->isRunning(), 'Failed to start siege'); + $siege->wait(); + + invariant(!$siege->isRunning(), 'Siege is still running :/'); + invariant($php_engine->isRunning(), get_class($php_engine).' crashed'); + } else { + self::PrintProgress('Skipping single request warmup'); + } - invariant(!$siege->isRunning(), 'Siege is still running :/'); - invariant($php_engine->isRunning(), get_class($php_engine).' crashed'); + if (!$options->skipWarmUp) { + self::PrintProgress('Starting Siege for multi request warmup'); + $siege = new Siege($options, $target, RequestModes::WARMUP_MULTI); + $siege->start(); + invariant($siege->isRunning(), 'Failed to start siege'); + $siege->wait(); - self::PrintProgress('Starting Siege for multi request warmup'); - $siege = new Siege($options, $target, RequestModes::WARMUP_MULTI); - $siege->start(); - invariant($siege->isRunning(), 'Failed to start siege'); - $siege->wait(); - - invariant(!$siege->isRunning(), 'Siege is still running :/'); - invariant($php_engine->isRunning(), get_class($php_engine).' crashed'); + invariant(!$siege->isRunning(), 'Siege is still running :/'); + invariant($php_engine->isRunning(), get_class($php_engine).' crashed'); + } else { + self::PrintProgress('Skipping multi request warmup'); + } self::PrintProgress('Clearing nginx access.log'); $nginx->clearAccessLog(); - self::PrintProgress('Running Siege for benchmark'); + self::PrintProgress('Starting Siege for benchmark'); $siege = new Siege($options, $target, RequestModes::BENCHMARK); $siege->start(); invariant($siege->isRunning(), 'Siege failed to start');