protected function runAllPasses($name, $path)
{
// make sure the we have a good href for the target name
if (strpos($name, '://') === false) {
$href = "http://{$this->domain}/$name";
} else {
$href = $name;
}
// add a path if one exists
if ($path) {
$href .= "/$path";
}
// restart the server for a fresh environment
if ($this->restart) {
$this->outln("Restarting web server ...");
passthru($this->restart);
} else {
$this->outln("Not restarting web server.");
}
// prime the cache
$this->outln("$name: prime the cache");
passthru("{$this->curl} $href");
$this->outln();
// for each concurrency level ...
foreach ($this->concurrent as $conc) {
// make sure we have a concurrency level
$conc = (int) $conc;
if (! $conc) {
continue;
}
// make a log dir for the target href and concurrency
$log_name = "{$this->log_dir}/{$conc}/" . urlencode($href);
@mkdir($log_name, 0777, true);
// run each of the passes
for ($pass = 1; $pass <= $this->passes; $pass++) {
// where to log the pass?
$log_file = "{$log_name}/$pass.log";
// run the pass
$this->out("$name: ");
$this->out("concurrency $conc, ");
$this->outln("pass $pass of $this->passes");
$this->runOnePass($href, $conc, $log_file);
// show the req/sec from the pass
$req_sec = $this->fetchReqSec($log_file);
$this->outln("### req/sec: $req_sec ###");
// retain the req/sec data
$this->req_sec[$name][$conc][$pass] = $req_sec;
}
}
}