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

Commit

Permalink
Mark reference arguments at the call site (#90)
Browse files Browse the repository at this point in the history
HHVM 3.24 requires the reference arguments to be marked at the call site, following which the current oss-performance code throws errors when
"hh_client" is run or the workload is run using HHVM runtime. This patch fixes the issue by marking the reference arguments at the call time.

However, this patch also mandates the HHVM version to be at least 3.24 and makes it incompatible with the earlier versions as the change is
not supported in earlier versions of HHVM

Fixes #89
  • Loading branch information
sushmakt authored and fredemmott committed Jan 30, 2018
1 parent aa38192 commit f747fc5
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions base/DatabaseInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public function installDatabase(): bool {
Utils::EscapeCommand(
Vector {'mysql', '-h', $dbHost.'', $db, '-u', $db, '-p'.$db},
),
$output,
$ret,
&$output,
&$ret,
);

if ($ret !== 0) {
Expand Down
2 changes: 1 addition & 1 deletion base/HHVMDaemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(private PerfOptions $options) {
if ($options->traceSubProcess) {
fprintf(STDERR, "%s\n", $check_command);
}
exec($check_command, $output);
exec($check_command, &$output);
$checks = json_decode(implode("\n", $output), /* as array = */ true);
invariant($checks, 'Got invalid output from hhvm_config_check.php');
if (array_key_exists('HHVM_VERSION', $checks)) {
Expand Down
2 changes: 1 addition & 1 deletion base/NginxDaemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private static function GetPercentiles(
Vector<float> $times,
): Map<string, float> {
$count = count($times);
sort($times);
sort(&$times);
return Map {
'Nginx P50 time' => $times[(int) ($count * 0.5)],
'Nginx P90 time' => $times[(int) ($count * 0.9)],
Expand Down
4 changes: 2 additions & 2 deletions base/PHP5Daemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(private PerfOptions $options) {
if ($options->traceSubProcess) {
fprintf(STDERR, "%s\n", $check_command);
}
exec($check_command, $output);
exec($check_command, &$output);
$check = array_search('Opcode Caching => Up and Running', $output, true);
invariant($check, 'Got invalid output from php-fpm -i');
} else {
Expand All @@ -51,7 +51,7 @@ public function __construct(private PerfOptions $options) {
if ($options->traceSubProcess) {
fprintf(STDERR, "%s\n", $check_command);
}
exec($check_command, $output);
exec($check_command, &$output);
$checks = json_decode(implode("\n", $output), /* as array = */ true);
invariant($checks, 'Got invalid output from php-src_config_check.php');
BuildChecker::Check(
Expand Down
4 changes: 2 additions & 2 deletions base/PerfOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public function __construct(Vector<string> $argv) {
if ($fraction !== 1.0) {
$this->cpuBind = true;
$output = [];
exec('nproc', $output);
exec('nproc', &$output);
$numProcessors = (int)($output[0]);
$numDaemonProcessors = (int)($numProcessors * $fraction);
$this->helperProcessors = "$numDaemonProcessors-$numProcessors";
Expand Down Expand Up @@ -391,7 +391,7 @@ public function validate() {
$ret = 0;
$output = "";
$this->siegeTmpDir = exec('ssh ' .
$this->remoteSiege . ' mktemp -d ', $output, $ret);
$this->remoteSiege . ' mktemp -d ', &$output, &$ret);
if ($ret) {
invariant_violation('%s',
'Invalid ssh credentials: ' . $this->remoteSiege);
Expand Down
2 changes: 1 addition & 1 deletion base/PerfRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private static function RunWithOptionsAndEngine(
$combined_stats =
$combined_stats->filterWithKey(($k, $v) ==> $k === 'Combined');
} else {
ksort($combined_stats);
ksort(&$combined_stats);
}
$combined_stats['Combined']['canonical'] =
(int) !$options->notBenchmarking;
Expand Down
2 changes: 1 addition & 1 deletion base/PerfTarget.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final public function applyPatches(): void {
}

$patches = glob($dir.'/*.patch');
sort($patches);
sort(&$patches);

$dir = escapeshellarg($this->getSourceRoot());

Expand Down
4 changes: 2 additions & 2 deletions base/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function startWorker(
}
}

$proc = proc_open($this->command, $spec, $pipes, null, $env);
$proc = proc_open($this->command, $spec, &$pipes, null, $env);

// Give the shell some time to figure out if it could actually launch the
// process
Expand Down Expand Up @@ -163,7 +163,7 @@ public function wait(): void {
return;
}
$status = null;
pcntl_waitpid($pid, $status);
pcntl_waitpid($pid, &$status);
}

public function __destruct() {
Expand Down
4 changes: 2 additions & 2 deletions base/SiegeStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public function collectStats(): Map<string, Map<string, num>> {
explode("\n", trim(file_get_contents($this->getLogFilePath())));
if (count($log_lines) > 1) {
// Remove possible header line
array_splice($log_lines, 0, 1);
array_splice(&$log_lines, 0, 1);
}
invariant(
count($log_lines) === 1,
'Expected 1 line in siege log file, got %d',
count($log_lines),
);
$log_line = array_pop($log_lines);
$log_line = array_pop(&$log_lines);
$data = (new Vector(explode(',', $log_line)))->map($x ==> trim($x));
return Map {
'Combined' => Map {
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"require-dev": {
"hhvm": "^3.24"
},
"autoload": {
"classmap": ["base/", "targets/"]
}
Expand Down
2 changes: 1 addition & 1 deletion targets/magento1/Magento1Target.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function install(): void {
exit(0);
}
$status = null;
pcntl_waitpid($child, $status);
pcntl_waitpid($child, &$status);
}

private function getInstallerArgs(): array {
Expand Down

0 comments on commit f747fc5

Please sign in to comment.