{"action":"created","comment":{"url":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/comments/36617291","id":36617291,"diff_hunk":"@@ -0,0 +1,95 @@\n+import logging\n+import numpy as np\n+import struct\n+\n+from .region import Region\n+\n+MS_SCALE = (1.0 / 200032.4)\n+\n+logger = logging.getLogger(__name__)\n+\n+\n+class Profiler(Region):\n+    \"\"\"Region used to record spikes.\"\"\"\n+    def __init__(self, n_samples):\n+        self.n_samples = n_samples\n+\n+    def sizeof(self, vertex_slice):\n+        # 1 word counter and 2 words per sample\n+        return 4 + (8 * self.n_samples)\n+\n+    def write_subregion_to_file(self, *args, **kwargs):  # pragma: no cover\n+        pass  # Nothing to do\n+\n+    def read_from_mem(self, mem, tag_names):\n+        # Read number of words written by profiler\n+        word_written = struct.unpack(\"I\", mem.read(4))[0]\n+\n+        # Read these from memory\n+        data = np.fromstring(mem.read(word_written * 4), dtype=np.uint64)","path":"nengo_spinnaker/regions/profiler.py","position":29,"original_position":29,"commit_id":"99ab846a75f05b4ca801b928ecc3bd45c4dcbf78","original_commit_id":"99ab846a75f05b4ca801b928ecc3bd45c4dcbf78","user":{"login":"neworderofjamie","id":6793242,"avatar_url":"https://avatars.githubusercontent.com/u/6793242?v=3","gravatar_id":"","url":"https://api.github.com/users/neworderofjamie","html_url":"https://github.com/neworderofjamie","followers_url":"https://api.github.com/users/neworderofjamie/followers","following_url":"https://api.github.com/users/neworderofjamie/following{/other_user}","gists_url":"https://api.github.com/users/neworderofjamie/gists{/gist_id}","starred_url":"https://api.github.com/users/neworderofjamie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neworderofjamie/subscriptions","organizations_url":"https://api.github.com/users/neworderofjamie/orgs","repos_url":"https://api.github.com/users/neworderofjamie/repos","events_url":"https://api.github.com/users/neworderofjamie/events{/privacy}","received_events_url":"https://api.github.com/users/neworderofjamie/received_events","type":"User","site_admin":false},"body":"Yeah, fine point - this could be read in uint32s to start with","created_at":"2015-08-10T10:11:15Z","updated_at":"2015-08-10T10:11:15Z","html_url":"https://github.com/project-rig/nengo_spinnaker/pull/52#discussion_r36617291","pull_request_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/52","_links":{"self":{"href":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/comments/36617291"},"html":{"href":"https://github.com/project-rig/nengo_spinnaker/pull/52#discussion_r36617291"},"pull_request":{"href":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/52","id":42003109,"html_url":"https://github.com/project-rig/nengo_spinnaker/pull/52","diff_url":"https://github.com/project-rig/nengo_spinnaker/pull/52.diff","patch_url":"https://github.com/project-rig/nengo_spinnaker/pull/52.patch","issue_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/issues/52","number":52,"state":"open","locked":false,"title":"Profiling new","user":{"login":"neworderofjamie","id":6793242,"avatar_url":"https://avatars.githubusercontent.com/u/6793242?v=3","gravatar_id":"","url":"https://api.github.com/users/neworderofjamie","html_url":"https://github.com/neworderofjamie","followers_url":"https://api.github.com/users/neworderofjamie/followers","following_url":"https://api.github.com/users/neworderofjamie/following{/other_user}","gists_url":"https://api.github.com/users/neworderofjamie/gists{/gist_id}","starred_url":"https://api.github.com/users/neworderofjamie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neworderofjamie/subscriptions","organizations_url":"https://api.github.com/users/neworderofjamie/orgs","repos_url":"https://api.github.com/users/neworderofjamie/repos","events_url":"https://api.github.com/users/neworderofjamie/events{/privacy}","received_events_url":"https://api.github.com/users/neworderofjamie/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-10T09:49:23Z","updated_at":"2015-08-10T10:11:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea541b5b2bae494adda68960a689f4e11b131859","assignee":{"login":"mundya","id":3439837,"avatar_url":"https://avatars.githubusercontent.com/u/3439837?v=3","gravatar_id":"","url":"https://api.github.com/users/mundya","html_url":"https://github.com/mundya","followers_url":"https://api.github.com/users/mundya/followers","following_url":"https://api.github.com/users/mundya/following{/other_user}","gists_url":"https://api.github.com/users/mundya/gists{/gist_id}","starred_url":"https://api.github.com/users/mundya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mundya/subscriptions","organizations_url":"https://api.github.com/users/mundya/orgs","repos_url":"https://api.github.com/users/mundya/repos","events_url":"https://api.github.com/users/mundya/events{/privacy}","received_events_url":"https://api.github.com/users/mundya/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/52/commits","review_comments_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/52/comments","review_comment_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/issues/52/comments","statuses_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/statuses/99ab846a75f05b4ca801b928ecc3bd45c4dcbf78","head":{"label":"project-rig:profiling_new","ref":"profiling_new","sha":"99ab846a75f05b4ca801b928ecc3bd45c4dcbf78","user":{"login":"project-rig","id":11227885,"avatar_url":"https://avatars.githubusercontent.com/u/11227885?v=3","gravatar_id":"","url":"https://api.github.com/users/project-rig","html_url":"https://github.com/project-rig","followers_url":"https://api.github.com/users/project-rig/followers","following_url":"https://api.github.com/users/project-rig/following{/other_user}","gists_url":"https://api.github.com/users/project-rig/gists{/gist_id}","starred_url":"https://api.github.com/users/project-rig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-rig/subscriptions","organizations_url":"https://api.github.com/users/project-rig/orgs","repos_url":"https://api.github.com/users/project-rig/repos","events_url":"https://api.github.com/users/project-rig/events{/privacy}","received_events_url":"https://api.github.com/users/project-rig/received_events","type":"Organization","site_admin":false},"repo":{"id":33400802,"name":"nengo_spinnaker","full_name":"project-rig/nengo_spinnaker","owner":{"login":"project-rig","id":11227885,"avatar_url":"https://avatars.githubusercontent.com/u/11227885?v=3","gravatar_id":"","url":"https://api.github.com/users/project-rig","html_url":"https://github.com/project-rig","followers_url":"https://api.github.com/users/project-rig/followers","following_url":"https://api.github.com/users/project-rig/following{/other_user}","gists_url":"https://api.github.com/users/project-rig/gists{/gist_id}","starred_url":"https://api.github.com/users/project-rig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-rig/subscriptions","organizations_url":"https://api.github.com/users/project-rig/orgs","repos_url":"https://api.github.com/users/project-rig/repos","events_url":"https://api.github.com/users/project-rig/events{/privacy}","received_events_url":"https://api.github.com/users/project-rig/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/project-rig/nengo_spinnaker","description":"SpiNNaker based Nengo simulator.","fork":false,"url":"https://api.github.com/repos/project-rig/nengo_spinnaker","forks_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/forks","keys_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/teams","hooks_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/hooks","issue_events_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/issues/events{/number}","events_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/events","assignees_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/assignees{/user}","branches_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/branches{/branch}","tags_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/tags","blobs_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/git/refs{/sha}","trees_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/statuses/{sha}","languages_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/languages","stargazers_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/stargazers","contributors_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/contributors","subscribers_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/subscribers","subscription_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/subscription","commits_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/commits{/sha}","git_commits_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/git/commits{/sha}","comments_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/comments{/number}","issue_comment_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/issues/comments{/number}","contents_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/contents/{+path}","compare_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/merges","archive_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/downloads","issues_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/issues{/number}","pulls_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls{/number}","milestones_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/milestones{/number}","notifications_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/labels{/name}","releases_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/releases{/id}","created_at":"2015-04-04T09:41:15Z","updated_at":"2015-06-10T15:24:54Z","pushed_at":"2015-08-10T09:56:23Z","git_url":"git://github.com/project-rig/nengo_spinnaker.git","ssh_url":"git@github.com:project-rig/nengo_spinnaker.git","clone_url":"https://github.com/project-rig/nengo_spinnaker.git","svn_url":"https://github.com/project-rig/nengo_spinnaker","homepage":"","size":2312,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":13,"forks":1,"open_issues":13,"watchers":2,"default_branch":"master"}},"base":{"label":"project-rig:master","ref":"master","sha":"a1a3e08fca6ef35ab72df8f0ef83d27176bc9a06","user":{"login":"project-rig","id":11227885,"avatar_url":"https://avatars.githubusercontent.com/u/11227885?v=3","gravatar_id":"","url":"https://api.github.com/users/project-rig","html_url":"https://github.com/project-rig","followers_url":"https://api.github.com/users/project-rig/followers","following_url":"https://api.github.com/users/project-rig/following{/other_user}","gists_url":"https://api.github.com/users/project-rig/gists{/gist_id}","starred_url":"https://api.github.com/users/project-rig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-rig/subscriptions","organizations_url":"https://api.github.com/users/project-rig/orgs","repos_url":"https://api.github.com/users/project-rig/repos","events_url":"https://api.github.com/users/project-rig/events{/privacy}","received_events_url":"https://api.github.com/users/project-rig/received_events","type":"Organization","site_admin":false},"repo":{"id":33400802,"name":"nengo_spinnaker","full_name":"project-rig/nengo_spinnaker","owner":{"login":"project-rig","id":11227885,"avatar_url":"https://avatars.githubusercontent.com/u/11227885?v=3","gravatar_id":"","url":"https://api.github.com/users/project-rig","html_url":"https://github.com/project-rig","followers_url":"https://api.github.com/users/project-rig/followers","following_url":"https://api.github.com/users/project-rig/following{/other_user}","gists_url":"https://api.github.com/users/project-rig/gists{/gist_id}","starred_url":"https://api.github.com/users/project-rig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-rig/subscriptions","organizations_url":"https://api.github.com/users/project-rig/orgs","repos_url":"https://api.github.com/users/project-rig/repos","events_url":"https://api.github.com/users/project-rig/events{/privacy}","received_events_url":"https://api.github.com/users/project-rig/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/project-rig/nengo_spinnaker","description":"SpiNNaker based Nengo simulator.","fork":false,"url":"https://api.github.com/repos/project-rig/nengo_spinnaker","forks_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/forks","keys_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/teams","hooks_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/hooks","issue_events_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/issues/events{/number}","events_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/events","assignees_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/assignees{/user}","branches_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/branches{/branch}","tags_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/tags","blobs_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/git/refs{/sha}","trees_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/statuses/{sha}","languages_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/languages","stargazers_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/stargazers","contributors_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/contributors","subscribers_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/subscribers","subscription_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/subscription","commits_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/commits{/sha}","git_commits_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/git/commits{/sha}","comments_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/comments{/number}","issue_comment_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/issues/comments{/number}","contents_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/contents/{+path}","compare_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/merges","archive_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/downloads","issues_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/issues{/number}","pulls_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls{/number}","milestones_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/milestones{/number}","notifications_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/labels{/name}","releases_url":"https://api.github.com/repos/project-rig/nengo_spinnaker/releases{/id}","created_at":"2015-04-04T09:41:15Z","updated_at":"2015-06-10T15:24:54Z","pushed_at":"2015-08-10T09:56:23Z","git_url":"git://github.com/project-rig/nengo_spinnaker.git","ssh_url":"git@github.com:project-rig/nengo_spinnaker.git","clone_url":"https://github.com/project-rig/nengo_spinnaker.git","svn_url":"https://github.com/project-rig/nengo_spinnaker","homepage":"","size":2312,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":13,"forks":1,"open_issues":13,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/52"},"html":{"href":"https://github.com/project-rig/nengo_spinnaker/pull/52"},"issue":{"href":"https://api.github.com/repos/project-rig/nengo_spinnaker/issues/52"},"comments":{"href":"https://api.github.com/repos/project-rig/nengo_spinnaker/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/project-rig/nengo_spinnaker/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/project-rig/nengo_spinnaker/statuses/99ab846a75f05b4ca801b928ecc3bd45c4dcbf78"}}}}