{"action":"created","comment":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/35377427","id":35377427,"diff_hunk":"@@ -0,0 +1,95 @@\n+#!/bin/python3\n+\n+# This filter replace all occurences of JIT_PPC_${address} by a\n+# corresponding function name JIT_PPC_${symbol} as defined by a .map file.\n+# TODO, add an option to append the block address (JIT_PPC_${symbol}@${addr})\n+\n+# Example 1: guest function profiling (excluding host callees)\n+#\n+# $ perf record -t $tid\n+# $ per perf script | sed 's/.*cycles: *[0-9a-f]* *//' |\n+#    python3 Tools/symbolicate-ppc.py ~/.dolphin-emu/Maps/${map}.map |\n+#    rankor -r | head\n+#  10.05% JIT_Loop (/tmp/perf-15936.map)\n+#   3.73% [unknown] (/tmp/perf-15936.map)\n+#   1.91% VideoBackendHardware::Video_GatherPipeBursted (/opt/dolphin-2015-05-06/bin/dolphin-emu)\n+#   1.39% JIT_PPC_PSMTXConcat (/tmp/perf-15936.map)\n+#   1.00% JIT_PPC_zz_051754c_ (/tmp/perf-15936.map)\n+#   0.90% JIT_PPC_zz_051751c_ (/tmp/perf-15936.map)\n+#   0.71% JIT_PPC_zz_04339d4_ (/tmp/perf-15936.map)\n+#   0.59% JIT_PPC_zz_05173e0_ (/tmp/perf-15936.map)\n+#   0.57% JIT_PPC_zz_044141c_ (/tmp/perf-15936.map)\n+#   0.54% JIT_PPC_zz_01839cc_ (/tmp/perf-15936.map)\n+\n+# Example 2: guest function profiling (including host callees)\n+#\n+# $ perf record --call-graph dwarf -t $tid\n+# $ perf script | stackcollapse-perf.pl | sed 's/^CPU;// ' |\n+#     python3 Tools/symbolicate-ppc.py ~/.dolphin-emu/Maps/${map}.map |\n+#     perl -pe 's/^([^; ]*).*? ([0-9]+?)$/\\1 \\2/' | stackcollapse-recursive.pl |\n+#     awk '{printf \"%s %s\\n\", $2, $1}' | sort -rn | head\n+# 5811 JIT_Loop\n+# 2396 [unknown]\n+# 577 JIT_PPC_PSMTXConcat\n+# 464 JIT_PPC___restore_gpr\n+# 396 JIT_PPC_zz_0517514_\n+# 313 JIT_PPC_zz_04339d4_\n+# 290 JIT_PPC_zz_05173e0_\n+# 285 JIT_PPC_zz_01839cc_\n+# 277 JIT_PPC_zz_04335ac_\n+# 269 JIT_PPC_zz_0420b58_\n+\n+import re\n+import sys\n+\n+stdin = sys.stdin\n+stdout = sys.stdout\n+\n+class Symbol:\n+    def __init__(self, start, size, name):\n+        self.start = start\n+        self.end = start + size\n+        self.name = name\n+\n+# Groke a .map file, the format is. This is a line-oriented file containing\n+# mapping from the (PowerPC) memory addresses to function names.\n+# The format is: \"%08x %08x %08x %i %s\" (address, size, address, 0, name).\n+# They should be already be sorted.\n+def read_map(filename):\n+    reg = re.compile(\"^([0-9a-f]{8}) ([0-9a-f]{8}) ([0-9a-f]{8}) ([0-9]*) (.*)$\")\n+    res = []\n+    with open(filename, \"r\") as f:\n+        for line in f:\n+            match = reg.match(line)\n+            if match:\n+                start = int(match.group(1), 16)\n+                size  = int(match.group(2), 16)\n+                name  = match.group(5)\n+                res.append(Symbol(start, size, name))\n+    return res\n+\n+map = read_map(sys.argv[1])\n+\n+# Do a binary each in the map file in order to find the symbol:\n+def lookup(address):\n+    i = 0\n+    j = len(map)\n+    while(True):\n+        if (j < i):\n+            return \"JIT_PPC_[unknown]\"\n+        k = round((j + i) // 2)\n+        if (address < map[k].start):\n+            j = k - 1\n+        elif (address >= map[k].end):\n+            i = k + 1\n+        else:\n+            return \"JIT_PPC_\" + map[k].name\n+\n+# Function used to replaca given match:","path":"Tools/symbolicate-ppc.py","position":88,"original_position":88,"commit_id":"670746c1bad1fe09cb965e28ba2dc6d546a13de9","original_commit_id":"d30d1e67de60c3618b0ecf30311f3a00a1614c5c","user":{"login":"Tilka","id":123798,"avatar_url":"https://avatars.githubusercontent.com/u/123798?v=3","gravatar_id":"","url":"https://api.github.com/users/Tilka","html_url":"https://github.com/Tilka","followers_url":"https://api.github.com/users/Tilka/followers","following_url":"https://api.github.com/users/Tilka/following{/other_user}","gists_url":"https://api.github.com/users/Tilka/gists{/gist_id}","starred_url":"https://api.github.com/users/Tilka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tilka/subscriptions","organizations_url":"https://api.github.com/users/Tilka/orgs","repos_url":"https://api.github.com/users/Tilka/repos","events_url":"https://api.github.com/users/Tilka/events{/privacy}","received_events_url":"https://api.github.com/users/Tilka/received_events","type":"User","site_admin":false},"body":"Typo.","created_at":"2015-07-23T22:06:18Z","updated_at":"2015-07-23T22:06:18Z","html_url":"https://github.com/dolphin-emu/dolphin/pull/2772#discussion_r35377427","pull_request_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2772","_links":{"self":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/35377427"},"html":{"href":"https://github.com/dolphin-emu/dolphin/pull/2772#discussion_r35377427"},"pull_request":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2772"}}},"pull_request":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2772","id":40720191,"html_url":"https://github.com/dolphin-emu/dolphin/pull/2772","diff_url":"https://github.com/dolphin-emu/dolphin/pull/2772.diff","patch_url":"https://github.com/dolphin-emu/dolphin/pull/2772.patch","issue_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/2772","number":2772,"state":"open","locked":false,"title":"Tool to transform JIT_PPC_${address} to JIT_PPC_${symbol}","user":{"login":"randomstuff","id":946727,"avatar_url":"https://avatars.githubusercontent.com/u/946727?v=3","gravatar_id":"","url":"https://api.github.com/users/randomstuff","html_url":"https://github.com/randomstuff","followers_url":"https://api.github.com/users/randomstuff/followers","following_url":"https://api.github.com/users/randomstuff/following{/other_user}","gists_url":"https://api.github.com/users/randomstuff/gists{/gist_id}","starred_url":"https://api.github.com/users/randomstuff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randomstuff/subscriptions","organizations_url":"https://api.github.com/users/randomstuff/orgs","repos_url":"https://api.github.com/users/randomstuff/repos","events_url":"https://api.github.com/users/randomstuff/events{/privacy}","received_events_url":"https://api.github.com/users/randomstuff/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-23T21:25:11Z","updated_at":"2015-07-23T22:06:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9ad6d13ece66e81eaf02cfa0908a456ff3765f3e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2772/commits","review_comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2772/comments","review_comment_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/2772/comments","statuses_url":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/670746c1bad1fe09cb965e28ba2dc6d546a13de9","head":{"label":"randomstuff:symbolicate-ppc","ref":"symbolicate-ppc","sha":"670746c1bad1fe09cb965e28ba2dc6d546a13de9","user":{"login":"randomstuff","id":946727,"avatar_url":"https://avatars.githubusercontent.com/u/946727?v=3","gravatar_id":"","url":"https://api.github.com/users/randomstuff","html_url":"https://github.com/randomstuff","followers_url":"https://api.github.com/users/randomstuff/followers","following_url":"https://api.github.com/users/randomstuff/following{/other_user}","gists_url":"https://api.github.com/users/randomstuff/gists{/gist_id}","starred_url":"https://api.github.com/users/randomstuff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randomstuff/subscriptions","organizations_url":"https://api.github.com/users/randomstuff/orgs","repos_url":"https://api.github.com/users/randomstuff/repos","events_url":"https://api.github.com/users/randomstuff/events{/privacy}","received_events_url":"https://api.github.com/users/randomstuff/received_events","type":"User","site_admin":false},"repo":{"id":25321526,"name":"dolphin","full_name":"randomstuff/dolphin","owner":{"login":"randomstuff","id":946727,"avatar_url":"https://avatars.githubusercontent.com/u/946727?v=3","gravatar_id":"","url":"https://api.github.com/users/randomstuff","html_url":"https://github.com/randomstuff","followers_url":"https://api.github.com/users/randomstuff/followers","following_url":"https://api.github.com/users/randomstuff/following{/other_user}","gists_url":"https://api.github.com/users/randomstuff/gists{/gist_id}","starred_url":"https://api.github.com/users/randomstuff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randomstuff/subscriptions","organizations_url":"https://api.github.com/users/randomstuff/orgs","repos_url":"https://api.github.com/users/randomstuff/repos","events_url":"https://api.github.com/users/randomstuff/events{/privacy}","received_events_url":"https://api.github.com/users/randomstuff/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/randomstuff/dolphin","description":"Dolphin is a GameCube/Wii emulator, allowing you to play games for these two platforms on PC, with improvements.","fork":true,"url":"https://api.github.com/repos/randomstuff/dolphin","forks_url":"https://api.github.com/repos/randomstuff/dolphin/forks","keys_url":"https://api.github.com/repos/randomstuff/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/randomstuff/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/randomstuff/dolphin/teams","hooks_url":"https://api.github.com/repos/randomstuff/dolphin/hooks","issue_events_url":"https://api.github.com/repos/randomstuff/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/randomstuff/dolphin/events","assignees_url":"https://api.github.com/repos/randomstuff/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/randomstuff/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/randomstuff/dolphin/tags","blobs_url":"https://api.github.com/repos/randomstuff/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/randomstuff/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/randomstuff/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/randomstuff/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/randomstuff/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/randomstuff/dolphin/languages","stargazers_url":"https://api.github.com/repos/randomstuff/dolphin/stargazers","contributors_url":"https://api.github.com/repos/randomstuff/dolphin/contributors","subscribers_url":"https://api.github.com/repos/randomstuff/dolphin/subscribers","subscription_url":"https://api.github.com/repos/randomstuff/dolphin/subscription","commits_url":"https://api.github.com/repos/randomstuff/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/randomstuff/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/randomstuff/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/randomstuff/dolphin/issues/comments{/number}","contents_url":"https://api.github.com/repos/randomstuff/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/randomstuff/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/randomstuff/dolphin/merges","archive_url":"https://api.github.com/repos/randomstuff/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/randomstuff/dolphin/downloads","issues_url":"https://api.github.com/repos/randomstuff/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/randomstuff/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/randomstuff/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/randomstuff/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/randomstuff/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/randomstuff/dolphin/releases{/id}","created_at":"2014-10-16T20:59:34Z","updated_at":"2015-05-19T12:38:44Z","pushed_at":"2015-07-23T22:04:15Z","git_url":"git://github.com/randomstuff/dolphin.git","ssh_url":"git@github.com:randomstuff/dolphin.git","clone_url":"https://github.com/randomstuff/dolphin.git","svn_url":"https://github.com/randomstuff/dolphin","homepage":null,"size":217154,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"dolphin-emu:master","ref":"master","sha":"9e4dae4a036fdc2f0a78e04a4215cd24c5c3ca0f","user":{"login":"dolphin-emu","id":5050316,"avatar_url":"https://avatars.githubusercontent.com/u/5050316?v=3","gravatar_id":"","url":"https://api.github.com/users/dolphin-emu","html_url":"https://github.com/dolphin-emu","followers_url":"https://api.github.com/users/dolphin-emu/followers","following_url":"https://api.github.com/users/dolphin-emu/following{/other_user}","gists_url":"https://api.github.com/users/dolphin-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/dolphin-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dolphin-emu/subscriptions","organizations_url":"https://api.github.com/users/dolphin-emu/orgs","repos_url":"https://api.github.com/users/dolphin-emu/repos","events_url":"https://api.github.com/users/dolphin-emu/events{/privacy}","received_events_url":"https://api.github.com/users/dolphin-emu/received_events","type":"Organization","site_admin":false},"repo":{"id":11577304,"name":"dolphin","full_name":"dolphin-emu/dolphin","owner":{"login":"dolphin-emu","id":5050316,"avatar_url":"https://avatars.githubusercontent.com/u/5050316?v=3","gravatar_id":"","url":"https://api.github.com/users/dolphin-emu","html_url":"https://github.com/dolphin-emu","followers_url":"https://api.github.com/users/dolphin-emu/followers","following_url":"https://api.github.com/users/dolphin-emu/following{/other_user}","gists_url":"https://api.github.com/users/dolphin-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/dolphin-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dolphin-emu/subscriptions","organizations_url":"https://api.github.com/users/dolphin-emu/orgs","repos_url":"https://api.github.com/users/dolphin-emu/repos","events_url":"https://api.github.com/users/dolphin-emu/events{/privacy}","received_events_url":"https://api.github.com/users/dolphin-emu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dolphin-emu/dolphin","description":"Dolphin is a GameCube / Wii emulator, allowing you to play games for these two platforms on PC with improvements.","fork":false,"url":"https://api.github.com/repos/dolphin-emu/dolphin","forks_url":"https://api.github.com/repos/dolphin-emu/dolphin/forks","keys_url":"https://api.github.com/repos/dolphin-emu/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dolphin-emu/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dolphin-emu/dolphin/teams","hooks_url":"https://api.github.com/repos/dolphin-emu/dolphin/hooks","issue_events_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/dolphin-emu/dolphin/events","assignees_url":"https://api.github.com/repos/dolphin-emu/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/dolphin-emu/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/dolphin-emu/dolphin/tags","blobs_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/dolphin-emu/dolphin/languages","stargazers_url":"https://api.github.com/repos/dolphin-emu/dolphin/stargazers","contributors_url":"https://api.github.com/repos/dolphin-emu/dolphin/contributors","subscribers_url":"https://api.github.com/repos/dolphin-emu/dolphin/subscribers","subscription_url":"https://api.github.com/repos/dolphin-emu/dolphin/subscription","commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/comments{/number}","contents_url":"https://api.github.com/repos/dolphin-emu/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/dolphin-emu/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dolphin-emu/dolphin/merges","archive_url":"https://api.github.com/repos/dolphin-emu/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dolphin-emu/dolphin/downloads","issues_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/dolphin-emu/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/dolphin-emu/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dolphin-emu/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/dolphin-emu/dolphin/releases{/id}","created_at":"2013-07-22T09:07:57Z","updated_at":"2015-07-23T19:44:43Z","pushed_at":"2015-07-23T22:04:15Z","git_url":"git://github.com/dolphin-emu/dolphin.git","ssh_url":"git@github.com:dolphin-emu/dolphin.git","clone_url":"https://github.com/dolphin-emu/dolphin.git","svn_url":"https://github.com/dolphin-emu/dolphin","homepage":"https://dolphin-emu.org/","size":302014,"stargazers_count":1513,"watchers_count":1513,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":464,"mirror_url":null,"open_issues_count":76,"forks":464,"open_issues":76,"watchers":1513,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2772"},"html":{"href":"https://github.com/dolphin-emu/dolphin/pull/2772"},"issue":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/issues/2772"},"comments":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/issues/2772/comments"},"review_comments":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2772/comments"},"review_comment":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2772/commits"},"statuses":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/670746c1bad1fe09cb965e28ba2dc6d546a13de9"}}}}