{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/171152400","pull_request_review_id":99954223,"id":171152400,"diff_hunk":"@@ -213,6 +213,49 @@ internal static int OptimalMaxSpinWaitsPerSpinIteration\n             }\n         }\n \n+        [MethodImplAttribute(MethodImplOptions.InternalCall)]\n+        internal static extern int GetCurrentProcessorNumber();\n+\n+        // The upper bits of t_currentProcessorIdCache are the currentProcessorId. The lower bits of\n+        // the t_currentProcessorIdCache are counting down to get it periodically refreshed.\n+        // TODO: Consider flushing the currentProcessorIdCache on Wait operations or similar \n+        // actions that are likely to result in changing the executing core\n+        [ThreadStatic]\n+        private static int t_currentProcessorIdCache;\n+\n+        private const int ProcessorIdCacheShift = 16;\n+        private const int ProcessorIdCacheCountDownMask = (1 << ProcessorIdCacheShift) - 1;\n+        private const int ProcessorIdRefreshRate = 5000;\n+\n+        private static int RefreshCurrentProcessorId()\n+        {\n+            int currentProcessorId = GetCurrentProcessorNumber();\n+\n+            // On Unix, GetCurrentProcessorNumber() is implemented in terms of sched_getcpu, which\n+            // doesn't exist on all platforms.  On those it doesn't exist on, GetCurrentProcessorNumber()\n+            // returns -1.  As a fallback in that case and to spread the threads across the buckets\n+            // by default, we use the current managed thread ID as a proxy.\n+            if (currentProcessorId < 0) currentProcessorId = Environment.CurrentManagedThreadId;\n+\n+            Debug.Assert(ProcessorIdRefreshRate <= ProcessorIdCacheCountDownMask);","path":"src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs","position":28,"original_position":28,"commit_id":"a688e584e2d2876e8b5a8ca28c60ad98ee8f3699","original_commit_id":"a688e584e2d2876e8b5a8ca28c60ad98ee8f3699","user":{"login":"ahsonkhan","id":6527137,"avatar_url":"https://avatars1.githubusercontent.com/u/6527137?v=4","gravatar_id":"","url":"https://api.github.com/users/ahsonkhan","html_url":"https://github.com/ahsonkhan","followers_url":"https://api.github.com/users/ahsonkhan/followers","following_url":"https://api.github.com/users/ahsonkhan/following{/other_user}","gists_url":"https://api.github.com/users/ahsonkhan/gists{/gist_id}","starred_url":"https://api.github.com/users/ahsonkhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahsonkhan/subscriptions","organizations_url":"https://api.github.com/users/ahsonkhan/orgs","repos_url":"https://api.github.com/users/ahsonkhan/repos","events_url":"https://api.github.com/users/ahsonkhan/events{/privacy}","received_events_url":"https://api.github.com/users/ahsonkhan/received_events","type":"User","site_admin":false},"body":"Why we do we need this debug assert for comparing two const values?","created_at":"2018-02-28T06:24:38Z","updated_at":"2018-02-28T06:24:38Z","html_url":"https://github.com/dotnet/coreclr/pull/16650#discussion_r171152400","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/16650","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/171152400"},"html":{"href":"https://github.com/dotnet/coreclr/pull/16650#discussion_r171152400"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/16650"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/16650","id":171854841,"html_url":"https://github.com/dotnet/coreclr/pull/16650","diff_url":"https://github.com/dotnet/coreclr/pull/16650.diff","patch_url":"https://github.com/dotnet/coreclr/pull/16650.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/16650","number":16650,"state":"open","locked":false,"title":"Add Thread.GetCurrentProcessorId() API","user":{"login":"jkotas","id":6668460,"avatar_url":"https://avatars2.githubusercontent.com/u/6668460?v=4","gravatar_id":"","url":"https://api.github.com/users/jkotas","html_url":"https://github.com/jkotas","followers_url":"https://api.github.com/users/jkotas/followers","following_url":"https://api.github.com/users/jkotas/following{/other_user}","gists_url":"https://api.github.com/users/jkotas/gists{/gist_id}","starred_url":"https://api.github.com/users/jkotas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkotas/subscriptions","organizations_url":"https://api.github.com/users/jkotas/orgs","repos_url":"https://api.github.com/users/jkotas/repos","events_url":"https://api.github.com/users/jkotas/events{/privacy}","received_events_url":"https://api.github.com/users/jkotas/received_events","type":"User","site_admin":false},"body":"Contributes to https://github.com/dotnet/corefx/issues/16767","created_at":"2018-02-28T04:43:03Z","updated_at":"2018-02-28T06:24:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"70d4f2dba232e903f16f57ea68b226edf48bed1c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/16650/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/16650/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/16650/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/a688e584e2d2876e8b5a8ca28c60ad98ee8f3699","head":{"label":"jkotas:processorid","ref":"processorid","sha":"a688e584e2d2876e8b5a8ca28c60ad98ee8f3699","user":{"login":"jkotas","id":6668460,"avatar_url":"https://avatars2.githubusercontent.com/u/6668460?v=4","gravatar_id":"","url":"https://api.github.com/users/jkotas","html_url":"https://github.com/jkotas","followers_url":"https://api.github.com/users/jkotas/followers","following_url":"https://api.github.com/users/jkotas/following{/other_user}","gists_url":"https://api.github.com/users/jkotas/gists{/gist_id}","starred_url":"https://api.github.com/users/jkotas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkotas/subscriptions","organizations_url":"https://api.github.com/users/jkotas/orgs","repos_url":"https://api.github.com/users/jkotas/repos","events_url":"https://api.github.com/users/jkotas/events{/privacy}","received_events_url":"https://api.github.com/users/jkotas/received_events","type":"User","site_admin":false},"repo":{"id":30278571,"name":"coreclr","full_name":"jkotas/coreclr","owner":{"login":"jkotas","id":6668460,"avatar_url":"https://avatars2.githubusercontent.com/u/6668460?v=4","gravatar_id":"","url":"https://api.github.com/users/jkotas","html_url":"https://github.com/jkotas","followers_url":"https://api.github.com/users/jkotas/followers","following_url":"https://api.github.com/users/jkotas/following{/other_user}","gists_url":"https://api.github.com/users/jkotas/gists{/gist_id}","starred_url":"https://api.github.com/users/jkotas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkotas/subscriptions","organizations_url":"https://api.github.com/users/jkotas/orgs","repos_url":"https://api.github.com/users/jkotas/repos","events_url":"https://api.github.com/users/jkotas/events{/privacy}","received_events_url":"https://api.github.com/users/jkotas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jkotas/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR. It is an execution engine for .NET apps, performing functions such as IL byte code loading, compilation to machine code and garbage collection. The repo contains the complete up-to-date CoreCLR codebase.","fork":true,"url":"https://api.github.com/repos/jkotas/coreclr","forks_url":"https://api.github.com/repos/jkotas/coreclr/forks","keys_url":"https://api.github.com/repos/jkotas/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jkotas/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jkotas/coreclr/teams","hooks_url":"https://api.github.com/repos/jkotas/coreclr/hooks","issue_events_url":"https://api.github.com/repos/jkotas/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/jkotas/coreclr/events","assignees_url":"https://api.github.com/repos/jkotas/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/jkotas/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/jkotas/coreclr/tags","blobs_url":"https://api.github.com/repos/jkotas/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jkotas/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jkotas/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/jkotas/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jkotas/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/jkotas/coreclr/languages","stargazers_url":"https://api.github.com/repos/jkotas/coreclr/stargazers","contributors_url":"https://api.github.com/repos/jkotas/coreclr/contributors","subscribers_url":"https://api.github.com/repos/jkotas/coreclr/subscribers","subscription_url":"https://api.github.com/repos/jkotas/coreclr/subscription","commits_url":"https://api.github.com/repos/jkotas/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/jkotas/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/jkotas/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/jkotas/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/jkotas/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/jkotas/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jkotas/coreclr/merges","archive_url":"https://api.github.com/repos/jkotas/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jkotas/coreclr/downloads","issues_url":"https://api.github.com/repos/jkotas/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/jkotas/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/jkotas/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/jkotas/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jkotas/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/jkotas/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/jkotas/coreclr/deployments","created_at":"2015-02-04T03:09:04Z","updated_at":"2016-10-22T02:46:15Z","pushed_at":"2018-02-28T05:01:07Z","git_url":"git://github.com/jkotas/coreclr.git","ssh_url":"git@github.com:jkotas/coreclr.git","clone_url":"https://github.com/jkotas/coreclr.git","svn_url":"https://github.com/jkotas/coreclr","homepage":"","size":206729,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"f1fee6d7b4d06b17d872fdf587a4f87ca69827c2","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":30092893,"name":"coreclr","full_name":"dotnet/coreclr","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called System.Private.Corelib (or mscorlib). It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes. We welcome contributions.","fork":false,"url":"https://api.github.com/repos/dotnet/coreclr","forks_url":"https://api.github.com/repos/dotnet/coreclr/forks","keys_url":"https://api.github.com/repos/dotnet/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/coreclr/teams","hooks_url":"https://api.github.com/repos/dotnet/coreclr/hooks","issue_events_url":"https://api.github.com/repos/dotnet/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/coreclr/events","assignees_url":"https://api.github.com/repos/dotnet/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/coreclr/tags","blobs_url":"https://api.github.com/repos/dotnet/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/coreclr/languages","stargazers_url":"https://api.github.com/repos/dotnet/coreclr/stargazers","contributors_url":"https://api.github.com/repos/dotnet/coreclr/contributors","subscribers_url":"https://api.github.com/repos/dotnet/coreclr/subscribers","subscription_url":"https://api.github.com/repos/dotnet/coreclr/subscription","commits_url":"https://api.github.com/repos/dotnet/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/coreclr/merges","archive_url":"https://api.github.com/repos/dotnet/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/coreclr/downloads","issues_url":"https://api.github.com/repos/dotnet/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/coreclr/deployments","created_at":"2015-01-30T22:10:02Z","updated_at":"2018-02-28T03:54:30Z","pushed_at":"2018-02-28T06:20:16Z","git_url":"git://github.com/dotnet/coreclr.git","ssh_url":"git@github.com:dotnet/coreclr.git","clone_url":"https://github.com/dotnet/coreclr.git","svn_url":"https://github.com/dotnet/coreclr","homepage":"https://github.com/dotnet/core","size":208866,"stargazers_count":8986,"watchers_count":8986,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2257,"mirror_url":null,"archived":false,"open_issues_count":1578,"license":null,"forks":2257,"open_issues":1578,"watchers":8986,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/16650"},"html":{"href":"https://github.com/dotnet/coreclr/pull/16650"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/16650"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/16650/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/16650/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/16650/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/a688e584e2d2876e8b5a8ca28c60ad98ee8f3699"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"ahsonkhan"}}