Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Expose Siege duration and timeout parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorfox committed Feb 20, 2021
1 parent 877bf79 commit 1e0a98c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions base/PerfOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ final class PerfOptions {
public ?string $remoteSiege;
public ?string $siegeTmpDir;

public string $siegeDuration = '1M';
public string $siegeTimeout = '5m';

public function __construct(Vector<string> $argv) {
$def = Vector {
'help',
Expand Down Expand Up @@ -201,6 +204,8 @@ public function __construct(Vector<string> $argv) {
'server-threads:',
'client-threads:',
'remote-siege:',
'siege-duration:',
'siege-timeout:',
'memcached-port:',
'memcached-threads:',
'no-memcached', // do not use memcached (even if target supports it)
Expand Down Expand Up @@ -375,6 +380,17 @@ public function __construct(Vector<string> $argv) {
$this->srcDir = $this->getNullableString('src-dir');

$this->remoteSiege = $this->getNullableString('remote-siege');

$duration = $this->getNullableString('siege-duration');
if ($duration) {
$this->siegeDuration = $duration;
}

$timeout = $this->getNullableString('siege-timeout');
if ($timeout) {
$this->siegeTimeout = $timeout;
}

}

public function validate() {
Expand Down
4 changes: 2 additions & 2 deletions base/Siege.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected function getArguments(): Vector<string> {
// See Siege::getExecutablePath() - these arguments get passed to
// timeout
'--signal=9',
'5m',
$this->options->siegeTimeout,
parent::getExecutablePath(),
};
}
Expand Down Expand Up @@ -176,7 +176,7 @@ protected function getArguments(): Vector<string> {

if (!$this->options->noTimeLimit) {
$arguments->add('-t');
$arguments->add(PerfSettings::BenchmarkTime());
$arguments->add($this->options->siegeDuration);
}
return $arguments;
default:
Expand Down

0 comments on commit 1e0a98c

Please sign in to comment.