{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/28793230","id":28793230,"diff_hunk":"@@ -0,0 +1,141 @@\n+//\n+// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+//\n+// ===========================================================================\n+// File: perfmap.cpp\n+//\n+\n+#include \"common.h\"\n+#include \"perfmap.h\"\n+\n+PerfMap * PerfMap::s_Current = NULL;\n+\n+// Initialize the map for the process - called from EEStartupHelper.\n+void PerfMap::Initialize()\n+{\n+    LIMITED_METHOD_CONTRACT;\n+\n+    // Only enable the map if requested.\n+    if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled))\n+    {\n+        // Get the current process id.\n+        int currentPid = GetCurrentProcessId();\n+\n+        // Create the map.\n+        s_Current = new PerfMap(currentPid);\n+    }\n+}\n+\n+// Log a method to the map.\n+void PerfMap::LogMethod(MethodDesc * pMethod, PCODE pCode, size_t codeSize)\n+{\n+    LIMITED_METHOD_CONTRACT;\n+\n+    if (s_Current != NULL)\n+    {\n+        s_Current->Log(pMethod, pCode, codeSize);\n+    }\n+}\n+\n+// Destroy the map for the process - called from EEShutdownHelper.\n+void PerfMap::Destroy()\n+{\n+    if (s_Current != NULL)\n+    {\n+        delete s_Current;\n+        s_Current = NULL;\n+    }\n+}\n+\n+// Construct a new map for the process.\n+PerfMap::PerfMap(int pid)\n+{\n+    LIMITED_METHOD_CONTRACT;\n+\n+    // Initialize with no failures.\n+    m_ErrorEncountered = false;\n+\n+    // Build the path to the map file on disk.\n+    SString path;\n+#ifdef FEATURE_PAL\n+    path.Append(W(\"/tmp/perf-\"));","path":"src/vm/perfmap.cpp","position":62,"original_position":62,"commit_id":"c0cbe3635549f821e8bdd4fb8bc858e04737007b","original_commit_id":"c0cbe3635549f821e8bdd4fb8bc858e04737007b","user":{"login":"janvorli","id":10758568,"avatar_url":"https://avatars.githubusercontent.com/u/10758568?v=3","gravatar_id":"","url":"https://api.github.com/users/janvorli","html_url":"https://github.com/janvorli","followers_url":"https://api.github.com/users/janvorli/followers","following_url":"https://api.github.com/users/janvorli/following{/other_user}","gists_url":"https://api.github.com/users/janvorli/gists{/gist_id}","starred_url":"https://api.github.com/users/janvorli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janvorli/subscriptions","organizations_url":"https://api.github.com/users/janvorli/orgs","repos_url":"https://api.github.com/users/janvorli/repos","events_url":"https://api.github.com/users/janvorli/events{/privacy}","received_events_url":"https://api.github.com/users/janvorli/received_events","type":"User","site_admin":false},"body":"+1","created_at":"2015-04-21T16:01:56Z","updated_at":"2015-04-21T16:01:56Z","html_url":"https://github.com/dotnet/coreclr/pull/759#discussion_r28793230","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/759","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/28793230"},"html":{"href":"https://github.com/dotnet/coreclr/pull/759#discussion_r28793230"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/759"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/759","id":33772002,"html_url":"https://github.com/dotnet/coreclr/pull/759","diff_url":"https://github.com/dotnet/coreclr/pull/759.diff","patch_url":"https://github.com/dotnet/coreclr/pull/759.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/759","number":759,"state":"open","locked":false,"title":"Enable perf_events to resolve JIT compiled code addresses","user":{"login":"brianrob","id":6210322,"avatar_url":"https://avatars.githubusercontent.com/u/6210322?v=3","gravatar_id":"","url":"https://api.github.com/users/brianrob","html_url":"https://github.com/brianrob","followers_url":"https://api.github.com/users/brianrob/followers","following_url":"https://api.github.com/users/brianrob/following{/other_user}","gists_url":"https://api.github.com/users/brianrob/gists{/gist_id}","starred_url":"https://api.github.com/users/brianrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianrob/subscriptions","organizations_url":"https://api.github.com/users/brianrob/orgs","repos_url":"https://api.github.com/users/brianrob/repos","events_url":"https://api.github.com/users/brianrob/events{/privacy}","received_events_url":"https://api.github.com/users/brianrob/received_events","type":"User","site_admin":false},"body":"Adds a new COMPLUS variable that enables CoreCLR to emit a perfmap file (/tmp/perf-$pid.map).  This file is consumed by perf_events when collecting a trace and is used to resolve code addresses in JIT'd code.\r\n\r\nTo enable this feature: export COMPlus_PerfMapEnabled=1","created_at":"2015-04-21T15:18:33Z","updated_at":"2015-04-21T16:01:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7ea0852ac0476e58848175fe8ba2933a3ca99517","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/759/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/759/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/759/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/c0cbe3635549f821e8bdd4fb8bc858e04737007b","head":{"label":"brianrob:perfmap","ref":"perfmap","sha":"c0cbe3635549f821e8bdd4fb8bc858e04737007b","user":{"login":"brianrob","id":6210322,"avatar_url":"https://avatars.githubusercontent.com/u/6210322?v=3","gravatar_id":"","url":"https://api.github.com/users/brianrob","html_url":"https://github.com/brianrob","followers_url":"https://api.github.com/users/brianrob/followers","following_url":"https://api.github.com/users/brianrob/following{/other_user}","gists_url":"https://api.github.com/users/brianrob/gists{/gist_id}","starred_url":"https://api.github.com/users/brianrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianrob/subscriptions","organizations_url":"https://api.github.com/users/brianrob/orgs","repos_url":"https://api.github.com/users/brianrob/repos","events_url":"https://api.github.com/users/brianrob/events{/privacy}","received_events_url":"https://api.github.com/users/brianrob/received_events","type":"User","site_admin":false},"repo":{"id":30316731,"name":"coreclr","full_name":"brianrob/coreclr","owner":{"login":"brianrob","id":6210322,"avatar_url":"https://avatars.githubusercontent.com/u/6210322?v=3","gravatar_id":"","url":"https://api.github.com/users/brianrob","html_url":"https://github.com/brianrob","followers_url":"https://api.github.com/users/brianrob/followers","following_url":"https://api.github.com/users/brianrob/following{/other_user}","gists_url":"https://api.github.com/users/brianrob/gists{/gist_id}","starred_url":"https://api.github.com/users/brianrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianrob/subscriptions","organizations_url":"https://api.github.com/users/brianrob/orgs","repos_url":"https://api.github.com/users/brianrob/repos","events_url":"https://api.github.com/users/brianrob/events{/privacy}","received_events_url":"https://api.github.com/users/brianrob/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brianrob/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/brianrob/coreclr","forks_url":"https://api.github.com/repos/brianrob/coreclr/forks","keys_url":"https://api.github.com/repos/brianrob/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brianrob/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brianrob/coreclr/teams","hooks_url":"https://api.github.com/repos/brianrob/coreclr/hooks","issue_events_url":"https://api.github.com/repos/brianrob/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/brianrob/coreclr/events","assignees_url":"https://api.github.com/repos/brianrob/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/brianrob/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/brianrob/coreclr/tags","blobs_url":"https://api.github.com/repos/brianrob/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brianrob/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brianrob/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/brianrob/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brianrob/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/brianrob/coreclr/languages","stargazers_url":"https://api.github.com/repos/brianrob/coreclr/stargazers","contributors_url":"https://api.github.com/repos/brianrob/coreclr/contributors","subscribers_url":"https://api.github.com/repos/brianrob/coreclr/subscribers","subscription_url":"https://api.github.com/repos/brianrob/coreclr/subscription","commits_url":"https://api.github.com/repos/brianrob/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/brianrob/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/brianrob/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/brianrob/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/brianrob/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/brianrob/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brianrob/coreclr/merges","archive_url":"https://api.github.com/repos/brianrob/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brianrob/coreclr/downloads","issues_url":"https://api.github.com/repos/brianrob/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/brianrob/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/brianrob/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/brianrob/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brianrob/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/brianrob/coreclr/releases{/id}","created_at":"2015-02-04T19:27:15Z","updated_at":"2015-04-13T23:22:58Z","pushed_at":"2015-04-21T15:08:27Z","git_url":"git://github.com/brianrob/coreclr.git","ssh_url":"git@github.com:brianrob/coreclr.git","clone_url":"https://github.com/brianrob/coreclr.git","svn_url":"https://github.com/brianrob/coreclr","homepage":"","size":27567,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"d46b09d4dfc8e25d7e61a9994f89720cf01b5086","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","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://avatars.githubusercontent.com/u/9141961?v=3","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 mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","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}","created_at":"2015-01-30T22:10:02Z","updated_at":"2015-04-21T14:31:32Z","pushed_at":"2015-04-21T15:18:33Z","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":"","size":40517,"stargazers_count":4212,"watchers_count":4212,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":765,"mirror_url":null,"open_issues_count":106,"forks":765,"open_issues":106,"watchers":4212,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/759"},"html":{"href":"https://github.com/dotnet/coreclr/pull/759"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/759"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/759/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/759/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/759/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/c0cbe3635549f821e8bdd4fb8bc858e04737007b"}}}}