{"action":"created","comment":{"url":"https://api.github.com/repos/dantleech/phpbench/pulls/comments/30893830","id":30893830,"diff_hunk":"@@ -125,6 +145,97 @@ private function runSubject(Benchmark $benchmark, Subject $subject)\n         return $subjectResult;\n     }\n \n+    private function runIterations(Benchmark $benchmark, Subject $subject, $parameters, $nbIterations)\n+    {\n+        $iterationResults = array();\n+        for ($index = 0; $index < $nbIterations; $index++) {\n+            $iteration = new Iteration($index, $parameters);\n+            $iterationResults[] = $this->runIteration($benchmark, $subject, $iteration);\n+        }\n+\n+        return new IterationsResult($iterationResults, $parameters);\n+    }\n+\n+    private function runIterationsSeparateProcess(Benchmark $benchmark, Subject $subject, $parameters, $nbIterations, $processIsolation)\n+    {\n+        $reflection = new \\ReflectionClass(get_class($benchmark));\n+        $bin = realpath(__DIR__ . '/../..') . '/bin/phpbench';\n+\n+        switch ($processIsolation) {\n+            case 'iteration':\n+                $iterationCount = $nbIterations;\n+                $nbIterations = 1;\n+                break;\n+            case 'iterations':\n+                $iterationCount = 1;\n+                break;\n+            default:\n+                throw new \\RuntimeException(sprintf(\n+                    'Invalid process islation policy \"%s\". This really should not happen.',\n+                    $processIsolation\n+                ));\n+        }\n+\n+        $iterationsResult = array();\n+\n+        for ($index = 0; $index < $iterationCount; $index++) {\n+            $command = sprintf(\n+                'php %s run %s --subject=%s --nosetup --dump --parameters=%s --iterations=%d --processisolation=none',\n+                $bin,\n+                $reflection->getFileName(),\n+                $subject->getMethodName(),\n+                escapeshellarg(json_encode($parameters)),\n+                $nbIterations\n+            );\n+\n+            if ($this->configFile) {\n+                $command .= ' --config=' . $this->configFile;\n+            }\n+\n+            $descriptors = array(\n+                0 => array('pipe', 'r'),\n+                1 => array('pipe', 'w'),\n+                2 => array('pipe', 'w'),\n+            );\n+            $process = proc_open($command, $descriptors, $pipes);\n+            fclose($pipes[0]);\n+\n+            if (!is_resource($process)) {\n+                throw new \\RuntimeException(\n+                    'Could not spawn isolated process'\n+                );\n+            }\n+\n+            $output = stream_get_contents($pipes[1]);\n+            fclose($pipes[1]);\n+            $stderr = stream_get_contents($pipes[2]);\n+            fclose($pipes[2]);\n+            $exitCode = proc_close($process);\n+\n+            // randomly returns -1 on travis ..\n+            if (0 !== $exitCode) {\n+                throw new \\RuntimeException(sprintf(\n+                    'Isolated process returned exit code \"%s\". Command: \"%s\". StdOut: %snStdErr: %s',","path":"lib/Benchmark/Runner.php","position":184,"original_position":184,"commit_id":"904651da5024356681246d5dd6e27cc4ad555026","original_commit_id":"904651da5024356681246d5dd6e27cc4ad555026","user":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"body":"Fix formatting","created_at":"2015-05-22T13:21:44Z","updated_at":"2015-05-22T13:21:44Z","html_url":"https://github.com/dantleech/phpbench/pull/43#discussion_r30893830","pull_request_url":"https://api.github.com/repos/dantleech/phpbench/pulls/43","_links":{"self":{"href":"https://api.github.com/repos/dantleech/phpbench/pulls/comments/30893830"},"html":{"href":"https://github.com/dantleech/phpbench/pull/43#discussion_r30893830"},"pull_request":{"href":"https://api.github.com/repos/dantleech/phpbench/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/dantleech/phpbench/pulls/43","id":36004865,"html_url":"https://github.com/dantleech/phpbench/pull/43","diff_url":"https://github.com/dantleech/phpbench/pull/43.diff","patch_url":"https://github.com/dantleech/phpbench/pull/43.patch","issue_url":"https://api.github.com/repos/dantleech/phpbench/issues/43","number":43,"state":"open","locked":false,"title":"Process Isolation","user":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"body":"Support for running benchmarks in separate processes.\r\n\r\nAllows both running each individual iteration in isolation and sets of parameterized iterations.\r\n\r\nProcess isolation can be triggered via annotations or globally with the `--processisolation` option.\r\n\r\nIn addition this PR adds options for globally specifying parameters and the number of iterations to run for each test.","created_at":"2015-05-22T06:57:02Z","updated_at":"2015-05-22T13:21:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"28bbfcd82ab6ab7f648e69e8d9d47df0751e53a8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dantleech/phpbench/pulls/43/commits","review_comments_url":"https://api.github.com/repos/dantleech/phpbench/pulls/43/comments","review_comment_url":"https://api.github.com/repos/dantleech/phpbench/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dantleech/phpbench/issues/43/comments","statuses_url":"https://api.github.com/repos/dantleech/phpbench/statuses/904651da5024356681246d5dd6e27cc4ad555026","head":{"label":"dantleech:separate_process","ref":"separate_process","sha":"904651da5024356681246d5dd6e27cc4ad555026","user":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"repo":{"id":34982189,"name":"phpbench","full_name":"dantleech/phpbench","owner":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dantleech/phpbench","description":"PHP Benchmarking framework","fork":false,"url":"https://api.github.com/repos/dantleech/phpbench","forks_url":"https://api.github.com/repos/dantleech/phpbench/forks","keys_url":"https://api.github.com/repos/dantleech/phpbench/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dantleech/phpbench/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dantleech/phpbench/teams","hooks_url":"https://api.github.com/repos/dantleech/phpbench/hooks","issue_events_url":"https://api.github.com/repos/dantleech/phpbench/issues/events{/number}","events_url":"https://api.github.com/repos/dantleech/phpbench/events","assignees_url":"https://api.github.com/repos/dantleech/phpbench/assignees{/user}","branches_url":"https://api.github.com/repos/dantleech/phpbench/branches{/branch}","tags_url":"https://api.github.com/repos/dantleech/phpbench/tags","blobs_url":"https://api.github.com/repos/dantleech/phpbench/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dantleech/phpbench/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dantleech/phpbench/git/refs{/sha}","trees_url":"https://api.github.com/repos/dantleech/phpbench/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dantleech/phpbench/statuses/{sha}","languages_url":"https://api.github.com/repos/dantleech/phpbench/languages","stargazers_url":"https://api.github.com/repos/dantleech/phpbench/stargazers","contributors_url":"https://api.github.com/repos/dantleech/phpbench/contributors","subscribers_url":"https://api.github.com/repos/dantleech/phpbench/subscribers","subscription_url":"https://api.github.com/repos/dantleech/phpbench/subscription","commits_url":"https://api.github.com/repos/dantleech/phpbench/commits{/sha}","git_commits_url":"https://api.github.com/repos/dantleech/phpbench/git/commits{/sha}","comments_url":"https://api.github.com/repos/dantleech/phpbench/comments{/number}","issue_comment_url":"https://api.github.com/repos/dantleech/phpbench/issues/comments{/number}","contents_url":"https://api.github.com/repos/dantleech/phpbench/contents/{+path}","compare_url":"https://api.github.com/repos/dantleech/phpbench/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dantleech/phpbench/merges","archive_url":"https://api.github.com/repos/dantleech/phpbench/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dantleech/phpbench/downloads","issues_url":"https://api.github.com/repos/dantleech/phpbench/issues{/number}","pulls_url":"https://api.github.com/repos/dantleech/phpbench/pulls{/number}","milestones_url":"https://api.github.com/repos/dantleech/phpbench/milestones{/number}","notifications_url":"https://api.github.com/repos/dantleech/phpbench/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dantleech/phpbench/labels{/name}","releases_url":"https://api.github.com/repos/dantleech/phpbench/releases{/id}","created_at":"2015-05-03T10:34:08Z","updated_at":"2015-05-20T10:29:15Z","pushed_at":"2015-05-22T13:17:17Z","git_url":"git://github.com/dantleech/phpbench.git","ssh_url":"git@github.com:dantleech/phpbench.git","clone_url":"https://github.com/dantleech/phpbench.git","svn_url":"https://github.com/dantleech/phpbench","homepage":null,"size":817,"stargazers_count":41,"watchers_count":41,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":12,"forks":2,"open_issues":12,"watchers":41,"default_branch":"master"}},"base":{"label":"dantleech:master","ref":"master","sha":"7dd9f7671b09561c07fb6654d36a51577d7508ca","user":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"repo":{"id":34982189,"name":"phpbench","full_name":"dantleech/phpbench","owner":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dantleech/phpbench","description":"PHP Benchmarking framework","fork":false,"url":"https://api.github.com/repos/dantleech/phpbench","forks_url":"https://api.github.com/repos/dantleech/phpbench/forks","keys_url":"https://api.github.com/repos/dantleech/phpbench/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dantleech/phpbench/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dantleech/phpbench/teams","hooks_url":"https://api.github.com/repos/dantleech/phpbench/hooks","issue_events_url":"https://api.github.com/repos/dantleech/phpbench/issues/events{/number}","events_url":"https://api.github.com/repos/dantleech/phpbench/events","assignees_url":"https://api.github.com/repos/dantleech/phpbench/assignees{/user}","branches_url":"https://api.github.com/repos/dantleech/phpbench/branches{/branch}","tags_url":"https://api.github.com/repos/dantleech/phpbench/tags","blobs_url":"https://api.github.com/repos/dantleech/phpbench/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dantleech/phpbench/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dantleech/phpbench/git/refs{/sha}","trees_url":"https://api.github.com/repos/dantleech/phpbench/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dantleech/phpbench/statuses/{sha}","languages_url":"https://api.github.com/repos/dantleech/phpbench/languages","stargazers_url":"https://api.github.com/repos/dantleech/phpbench/stargazers","contributors_url":"https://api.github.com/repos/dantleech/phpbench/contributors","subscribers_url":"https://api.github.com/repos/dantleech/phpbench/subscribers","subscription_url":"https://api.github.com/repos/dantleech/phpbench/subscription","commits_url":"https://api.github.com/repos/dantleech/phpbench/commits{/sha}","git_commits_url":"https://api.github.com/repos/dantleech/phpbench/git/commits{/sha}","comments_url":"https://api.github.com/repos/dantleech/phpbench/comments{/number}","issue_comment_url":"https://api.github.com/repos/dantleech/phpbench/issues/comments{/number}","contents_url":"https://api.github.com/repos/dantleech/phpbench/contents/{+path}","compare_url":"https://api.github.com/repos/dantleech/phpbench/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dantleech/phpbench/merges","archive_url":"https://api.github.com/repos/dantleech/phpbench/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dantleech/phpbench/downloads","issues_url":"https://api.github.com/repos/dantleech/phpbench/issues{/number}","pulls_url":"https://api.github.com/repos/dantleech/phpbench/pulls{/number}","milestones_url":"https://api.github.com/repos/dantleech/phpbench/milestones{/number}","notifications_url":"https://api.github.com/repos/dantleech/phpbench/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dantleech/phpbench/labels{/name}","releases_url":"https://api.github.com/repos/dantleech/phpbench/releases{/id}","created_at":"2015-05-03T10:34:08Z","updated_at":"2015-05-20T10:29:15Z","pushed_at":"2015-05-22T13:17:17Z","git_url":"git://github.com/dantleech/phpbench.git","ssh_url":"git@github.com:dantleech/phpbench.git","clone_url":"https://github.com/dantleech/phpbench.git","svn_url":"https://github.com/dantleech/phpbench","homepage":null,"size":817,"stargazers_count":41,"watchers_count":41,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":12,"forks":2,"open_issues":12,"watchers":41,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dantleech/phpbench/pulls/43"},"html":{"href":"https://github.com/dantleech/phpbench/pull/43"},"issue":{"href":"https://api.github.com/repos/dantleech/phpbench/issues/43"},"comments":{"href":"https://api.github.com/repos/dantleech/phpbench/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/dantleech/phpbench/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/dantleech/phpbench/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dantleech/phpbench/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/dantleech/phpbench/statuses/904651da5024356681246d5dd6e27cc4ad555026"}}}}