{"action":"created","comment":{"url":"https://api.github.com/repos/colin-scott/page_load_time/pulls/comments/28206785","id":28206785,"diff_hunk":"@@ -96,9 +156,356 @@ def failed_url(url, output):\n     failed_set[url] = output\n     pickle.dump(failed_set, open('failed_urls', 'a'))\n \n+def copy_wpr_to_benchmark():\n+    \"\"\"Moves wpr and .pc.wpr (all) files from local data/wpr_source to chromium\n+\n+    located: /src/tools/perf/page_sets/data/\n+    \"\"\"\n+    local_path = os.path.join(os.getcwd(), 'data/wpr_source/*')\n+    remote_data_path = os.path.join(CHROMIUM_SRC, 'tools/perf/page_sets/data/')\n+    p = Popen('cp {0} {1}'.format(local_path, remote_data_path), shell=True)\n+\n+def prepare_benchmark(trial_number, num_urls):\n+    \"\"\"Simply checks to make sure the env is prepped before benchmarking\n+\n+    1. Ensures that ~/page_load_time/telemetry/temp/benchmark_results.db exists\n+    2. Writes benchmarks to ~/src/tools/perf/benchmarks/page_cycler.py if they\n+       do not already exist\n+    NOTE: You may need to clear out the end of\n+    ~/src/tools/perf/benchmarks/page_cycler.py for a clean start!\n+    :param trial_number: int for the number of this trial run\n+    :param num_urls: int of the number of urls to run through\n+    \"\"\"\n+    # Ensure benchmark_results.db exists\n+    telemetry_record_path = \\\n+    '/home/jamshed/page_load_time/telemetry/temp/benchmark_results.db'\n+    if not os.path.isfile(telemetry_record_path):\n+        # Create file\n+        tmp = {trial_number: {}}\n+        pickle.dump(tmp, open(telemetry_record_path, 'wb'))\n+    try:\n+        curr_pickle = pickle.load(open(telemetry_record_path, 'rb'))\n+    except IOError:\n+        # Raise exception or rewrite benchmark_results.db?\n+        tmp = {trial_number: {}}\n+        pickle.dump(tmp, open(telemetry_record_path, 'wb'))\n+\n+    # Write benchmarks to page_cycler.py\n+    page_cycler_path = '/home/jamshed/src/tools/perf/benchmarks/page_cycler.py'\n+    benchmark_template = (\"@benchmark.Enabled('android')\\n\"\n+                          \"class PageCyclerUrl{0}(_PageCycler):\\n\"\n+                          \"    page_set = page_sets.url{0}PageSet\\n\\n\")\n+\n+    with open(page_cycler_path, 'r+b') as f:\n+        line = f.readline()\n+        already_written = False\n+        while (line):\n+            if '### END OF URLS ###' in line:\n+                already_written = True\n+                break\n+            line = f.readline()\n+        if not already_written:\n+            # Need to write benchmarks to page_cycler.py, for now, just append\n+            f.write('\\n\\n')\n+            for i in range(num_urls):\n+                f.write(benchmark_template.format(i))\n+                f.write(benchmark_template.format('999999' + str(i)))\n+            f.write('### END OF URLS ###')\n+\n+def run_benchmarks(num_urls):\n+    \"\"\"Runs the page_cycler benchmark for each url\n+\n+    Dumps data /temp/benchmark_results.db\n+    :param num_urls: int of the number of urls to run through\n+    \"\"\"\n+    path.append('/home/jamshed/src/tools/perf/')\n+    cmd = ('sudo /home/jamshed/src/tools/perf/run_benchmark '\n+           'page_cycler.PageCyclerUrl{0}')\n+    for i in range(num_urls):\n+        p = Popen(cmd.format(i), shell=True)\n+        p.wait()  # We can only load 1 url on Chrome at a time\n+        # Also run the modified version\n+        p = Popen(cmd.format('999999' + str(i)), shell=True)\n+        p.wait()  # We can only load 1 url on Chrome at a time\n+\n+def aggregate_benchmark_data():\n+    \"\"\"Merges data from /temp/benchmark_results.db with /temp/aggregate.db","path":"telemetry/telemetry_record.py","position":195,"original_position":195,"commit_id":"73ea189bf4691a0fd52178f58c9a6d65eef5c0c2","original_commit_id":"73ea189bf4691a0fd52178f58c9a6d65eef5c0c2","user":{"login":"colin-scott","id":1466843,"avatar_url":"https://avatars.githubusercontent.com/u/1466843?v=3","gravatar_id":"","url":"https://api.github.com/users/colin-scott","html_url":"https://github.com/colin-scott","followers_url":"https://api.github.com/users/colin-scott/followers","following_url":"https://api.github.com/users/colin-scott/following{/other_user}","gists_url":"https://api.github.com/users/colin-scott/gists{/gist_id}","starred_url":"https://api.github.com/users/colin-scott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colin-scott/subscriptions","organizations_url":"https://api.github.com/users/colin-scott/orgs","repos_url":"https://api.github.com/users/colin-scott/repos","events_url":"https://api.github.com/users/colin-scott/events{/privacy}","received_events_url":"https://api.github.com/users/colin-scott/received_events","type":"User","site_admin":false},"body":"Mind explaining a bit more what the purpose of benchmark_results.db and /temp/aggregate.db are?\r\n\r\nAlso, is /temp/ not the same as /tmp? (i.e., is it a relative path?)\r\n\r\n(Obviously hypocritical of me, since my documentation is terrible. But now that there are two of us working with the same codebase, it's good to raise the standards)","created_at":"2015-04-12T20:01:24Z","updated_at":"2015-04-12T20:01:24Z","html_url":"https://github.com/colin-scott/page_load_time/pull/2#discussion_r28206785","pull_request_url":"https://api.github.com/repos/colin-scott/page_load_time/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/colin-scott/page_load_time/pulls/comments/28206785"},"html":{"href":"https://github.com/colin-scott/page_load_time/pull/2#discussion_r28206785"},"pull_request":{"href":"https://api.github.com/repos/colin-scott/page_load_time/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/colin-scott/page_load_time/pulls/2","id":33096599,"html_url":"https://github.com/colin-scott/page_load_time/pull/2","diff_url":"https://github.com/colin-scott/page_load_time/pull/2.diff","patch_url":"https://github.com/colin-scott/page_load_time/pull/2.patch","issue_url":"https://api.github.com/repos/colin-scott/page_load_time/issues/2","number":2,"state":"open","locked":false,"title":"Telemetry Benchmark End to End","user":{"login":"JamshedVesuna","id":2273987,"avatar_url":"https://avatars.githubusercontent.com/u/2273987?v=3","gravatar_id":"","url":"https://api.github.com/users/JamshedVesuna","html_url":"https://github.com/JamshedVesuna","followers_url":"https://api.github.com/users/JamshedVesuna/followers","following_url":"https://api.github.com/users/JamshedVesuna/following{/other_user}","gists_url":"https://api.github.com/users/JamshedVesuna/gists{/gist_id}","starred_url":"https://api.github.com/users/JamshedVesuna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamshedVesuna/subscriptions","organizations_url":"https://api.github.com/users/JamshedVesuna/orgs","repos_url":"https://api.github.com/users/JamshedVesuna/repos","events_url":"https://api.github.com/users/JamshedVesuna/events{/privacy}","received_events_url":"https://api.github.com/users/JamshedVesuna/received_events","type":"User","site_admin":false},"body":"Full end to end pipeline from target urls to har formatted data.\r\n\r\nNeed to verify headersSize calculation.","created_at":"2015-04-11T03:03:30Z","updated_at":"2015-04-12T20:01:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c1ddaf70ef32d4fce1f101c34bd8176b4c9909c5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/colin-scott/page_load_time/pulls/2/commits","review_comments_url":"https://api.github.com/repos/colin-scott/page_load_time/pulls/2/comments","review_comment_url":"https://api.github.com/repos/colin-scott/page_load_time/pulls/comments{/number}","comments_url":"https://api.github.com/repos/colin-scott/page_load_time/issues/2/comments","statuses_url":"https://api.github.com/repos/colin-scott/page_load_time/statuses/73ea189bf4691a0fd52178f58c9a6d65eef5c0c2","head":{"label":"colin-scott:benchmark","ref":"benchmark","sha":"73ea189bf4691a0fd52178f58c9a6d65eef5c0c2","user":{"login":"colin-scott","id":1466843,"avatar_url":"https://avatars.githubusercontent.com/u/1466843?v=3","gravatar_id":"","url":"https://api.github.com/users/colin-scott","html_url":"https://github.com/colin-scott","followers_url":"https://api.github.com/users/colin-scott/followers","following_url":"https://api.github.com/users/colin-scott/following{/other_user}","gists_url":"https://api.github.com/users/colin-scott/gists{/gist_id}","starred_url":"https://api.github.com/users/colin-scott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colin-scott/subscriptions","organizations_url":"https://api.github.com/users/colin-scott/orgs","repos_url":"https://api.github.com/users/colin-scott/repos","events_url":"https://api.github.com/users/colin-scott/events{/privacy}","received_events_url":"https://api.github.com/users/colin-scott/received_events","type":"User","site_admin":false},"repo":{"id":26149787,"name":"page_load_time","full_name":"colin-scott/page_load_time","owner":{"login":"colin-scott","id":1466843,"avatar_url":"https://avatars.githubusercontent.com/u/1466843?v=3","gravatar_id":"","url":"https://api.github.com/users/colin-scott","html_url":"https://github.com/colin-scott","followers_url":"https://api.github.com/users/colin-scott/followers","following_url":"https://api.github.com/users/colin-scott/following{/other_user}","gists_url":"https://api.github.com/users/colin-scott/gists{/gist_id}","starred_url":"https://api.github.com/users/colin-scott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colin-scott/subscriptions","organizations_url":"https://api.github.com/users/colin-scott/orgs","repos_url":"https://api.github.com/users/colin-scott/repos","events_url":"https://api.github.com/users/colin-scott/events{/privacy}","received_events_url":"https://api.github.com/users/colin-scott/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/colin-scott/page_load_time","description":"","fork":false,"url":"https://api.github.com/repos/colin-scott/page_load_time","forks_url":"https://api.github.com/repos/colin-scott/page_load_time/forks","keys_url":"https://api.github.com/repos/colin-scott/page_load_time/keys{/key_id}","collaborators_url":"https://api.github.com/repos/colin-scott/page_load_time/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/colin-scott/page_load_time/teams","hooks_url":"https://api.github.com/repos/colin-scott/page_load_time/hooks","issue_events_url":"https://api.github.com/repos/colin-scott/page_load_time/issues/events{/number}","events_url":"https://api.github.com/repos/colin-scott/page_load_time/events","assignees_url":"https://api.github.com/repos/colin-scott/page_load_time/assignees{/user}","branches_url":"https://api.github.com/repos/colin-scott/page_load_time/branches{/branch}","tags_url":"https://api.github.com/repos/colin-scott/page_load_time/tags","blobs_url":"https://api.github.com/repos/colin-scott/page_load_time/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/colin-scott/page_load_time/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/colin-scott/page_load_time/git/refs{/sha}","trees_url":"https://api.github.com/repos/colin-scott/page_load_time/git/trees{/sha}","statuses_url":"https://api.github.com/repos/colin-scott/page_load_time/statuses/{sha}","languages_url":"https://api.github.com/repos/colin-scott/page_load_time/languages","stargazers_url":"https://api.github.com/repos/colin-scott/page_load_time/stargazers","contributors_url":"https://api.github.com/repos/colin-scott/page_load_time/contributors","subscribers_url":"https://api.github.com/repos/colin-scott/page_load_time/subscribers","subscription_url":"https://api.github.com/repos/colin-scott/page_load_time/subscription","commits_url":"https://api.github.com/repos/colin-scott/page_load_time/commits{/sha}","git_commits_url":"https://api.github.com/repos/colin-scott/page_load_time/git/commits{/sha}","comments_url":"https://api.github.com/repos/colin-scott/page_load_time/comments{/number}","issue_comment_url":"https://api.github.com/repos/colin-scott/page_load_time/issues/comments{/number}","contents_url":"https://api.github.com/repos/colin-scott/page_load_time/contents/{+path}","compare_url":"https://api.github.com/repos/colin-scott/page_load_time/compare/{base}...{head}","merges_url":"https://api.github.com/repos/colin-scott/page_load_time/merges","archive_url":"https://api.github.com/repos/colin-scott/page_load_time/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/colin-scott/page_load_time/downloads","issues_url":"https://api.github.com/repos/colin-scott/page_load_time/issues{/number}","pulls_url":"https://api.github.com/repos/colin-scott/page_load_time/pulls{/number}","milestones_url":"https://api.github.com/repos/colin-scott/page_load_time/milestones{/number}","notifications_url":"https://api.github.com/repos/colin-scott/page_load_time/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/colin-scott/page_load_time/labels{/name}","releases_url":"https://api.github.com/repos/colin-scott/page_load_time/releases{/id}","created_at":"2014-11-04T02:46:53Z","updated_at":"2015-02-25T08:39:36Z","pushed_at":"2015-04-11T03:03:30Z","git_url":"git://github.com/colin-scott/page_load_time.git","ssh_url":"git@github.com:colin-scott/page_load_time.git","clone_url":"https://github.com/colin-scott/page_load_time.git","svn_url":"https://github.com/colin-scott/page_load_time","homepage":null,"size":3196,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"colin-scott:master","ref":"master","sha":"fbd44b8e8600a5d8343c0cf3d203abc2a911bbcf","user":{"login":"colin-scott","id":1466843,"avatar_url":"https://avatars.githubusercontent.com/u/1466843?v=3","gravatar_id":"","url":"https://api.github.com/users/colin-scott","html_url":"https://github.com/colin-scott","followers_url":"https://api.github.com/users/colin-scott/followers","following_url":"https://api.github.com/users/colin-scott/following{/other_user}","gists_url":"https://api.github.com/users/colin-scott/gists{/gist_id}","starred_url":"https://api.github.com/users/colin-scott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colin-scott/subscriptions","organizations_url":"https://api.github.com/users/colin-scott/orgs","repos_url":"https://api.github.com/users/colin-scott/repos","events_url":"https://api.github.com/users/colin-scott/events{/privacy}","received_events_url":"https://api.github.com/users/colin-scott/received_events","type":"User","site_admin":false},"repo":{"id":26149787,"name":"page_load_time","full_name":"colin-scott/page_load_time","owner":{"login":"colin-scott","id":1466843,"avatar_url":"https://avatars.githubusercontent.com/u/1466843?v=3","gravatar_id":"","url":"https://api.github.com/users/colin-scott","html_url":"https://github.com/colin-scott","followers_url":"https://api.github.com/users/colin-scott/followers","following_url":"https://api.github.com/users/colin-scott/following{/other_user}","gists_url":"https://api.github.com/users/colin-scott/gists{/gist_id}","starred_url":"https://api.github.com/users/colin-scott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colin-scott/subscriptions","organizations_url":"https://api.github.com/users/colin-scott/orgs","repos_url":"https://api.github.com/users/colin-scott/repos","events_url":"https://api.github.com/users/colin-scott/events{/privacy}","received_events_url":"https://api.github.com/users/colin-scott/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/colin-scott/page_load_time","description":"","fork":false,"url":"https://api.github.com/repos/colin-scott/page_load_time","forks_url":"https://api.github.com/repos/colin-scott/page_load_time/forks","keys_url":"https://api.github.com/repos/colin-scott/page_load_time/keys{/key_id}","collaborators_url":"https://api.github.com/repos/colin-scott/page_load_time/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/colin-scott/page_load_time/teams","hooks_url":"https://api.github.com/repos/colin-scott/page_load_time/hooks","issue_events_url":"https://api.github.com/repos/colin-scott/page_load_time/issues/events{/number}","events_url":"https://api.github.com/repos/colin-scott/page_load_time/events","assignees_url":"https://api.github.com/repos/colin-scott/page_load_time/assignees{/user}","branches_url":"https://api.github.com/repos/colin-scott/page_load_time/branches{/branch}","tags_url":"https://api.github.com/repos/colin-scott/page_load_time/tags","blobs_url":"https://api.github.com/repos/colin-scott/page_load_time/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/colin-scott/page_load_time/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/colin-scott/page_load_time/git/refs{/sha}","trees_url":"https://api.github.com/repos/colin-scott/page_load_time/git/trees{/sha}","statuses_url":"https://api.github.com/repos/colin-scott/page_load_time/statuses/{sha}","languages_url":"https://api.github.com/repos/colin-scott/page_load_time/languages","stargazers_url":"https://api.github.com/repos/colin-scott/page_load_time/stargazers","contributors_url":"https://api.github.com/repos/colin-scott/page_load_time/contributors","subscribers_url":"https://api.github.com/repos/colin-scott/page_load_time/subscribers","subscription_url":"https://api.github.com/repos/colin-scott/page_load_time/subscription","commits_url":"https://api.github.com/repos/colin-scott/page_load_time/commits{/sha}","git_commits_url":"https://api.github.com/repos/colin-scott/page_load_time/git/commits{/sha}","comments_url":"https://api.github.com/repos/colin-scott/page_load_time/comments{/number}","issue_comment_url":"https://api.github.com/repos/colin-scott/page_load_time/issues/comments{/number}","contents_url":"https://api.github.com/repos/colin-scott/page_load_time/contents/{+path}","compare_url":"https://api.github.com/repos/colin-scott/page_load_time/compare/{base}...{head}","merges_url":"https://api.github.com/repos/colin-scott/page_load_time/merges","archive_url":"https://api.github.com/repos/colin-scott/page_load_time/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/colin-scott/page_load_time/downloads","issues_url":"https://api.github.com/repos/colin-scott/page_load_time/issues{/number}","pulls_url":"https://api.github.com/repos/colin-scott/page_load_time/pulls{/number}","milestones_url":"https://api.github.com/repos/colin-scott/page_load_time/milestones{/number}","notifications_url":"https://api.github.com/repos/colin-scott/page_load_time/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/colin-scott/page_load_time/labels{/name}","releases_url":"https://api.github.com/repos/colin-scott/page_load_time/releases{/id}","created_at":"2014-11-04T02:46:53Z","updated_at":"2015-02-25T08:39:36Z","pushed_at":"2015-04-11T03:03:30Z","git_url":"git://github.com/colin-scott/page_load_time.git","ssh_url":"git@github.com:colin-scott/page_load_time.git","clone_url":"https://github.com/colin-scott/page_load_time.git","svn_url":"https://github.com/colin-scott/page_load_time","homepage":null,"size":3196,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/colin-scott/page_load_time/pulls/2"},"html":{"href":"https://github.com/colin-scott/page_load_time/pull/2"},"issue":{"href":"https://api.github.com/repos/colin-scott/page_load_time/issues/2"},"comments":{"href":"https://api.github.com/repos/colin-scott/page_load_time/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/colin-scott/page_load_time/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/colin-scott/page_load_time/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/colin-scott/page_load_time/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/colin-scott/page_load_time/statuses/73ea189bf4691a0fd52178f58c9a6d65eef5c0c2"}}}}