{"action":"created","comment":{"url":"https://api.github.com/repos/minetest/minetest/pulls/comments/68243865","id":68243865,"diff_hunk":"@@ -0,0 +1,42 @@\n+local profiler = {}\n+local profiler_path = core.get_builtin_path()..DIR_DELIM..\"profiler\"..DIR_DELIM\n+local sampler = dofile(profiler_path .. \"sampling.lua\")\n+local instrumentation  = assert(loadfile(profiler_path .. \"instrumentation.lua\"))(sampler)\n+local reporter = dofile(profiler_path .. \"reporter.lua\")\n+\n+function profiler.register_chatcommand()\n+\tlocal param_usage = \"print [filter] | dump [filter] | save [format [filter]] | reset\"\n+\tcore.register_chatcommand(\"profile\", {\n+\t\tdescription = \"handle profiling data\",\n+\t\tparams = param_usage,\n+\t\tprivs = { server=true },\n+\t\tfunc = function(name, param)\n+\t\t\tlocal command, arg0 = string.match(param, \"([^ ]+) ?(.*)\")\n+\t\t\tlocal args = arg0 and string.split(arg0, \" \")\n+\n+\t\t\tif command == \"dump\" then\n+\t\t\t\tcore.log(\"action\", reporter.print(sampler.profile, arg0))\n+\t\t\t\treturn true, \"Statistics written to action log\"\n+\t\t\telseif command == \"print\" then\n+\t\t\t\treturn true, reporter.print(sampler.profile, arg0)\n+\t\t\telseif command == \"save\" then\n+\t\t\t\treturn reporter.save(sampler.profile, args[1] or \"txt\", args[2])\n+\t\t\telseif command == \"reset\" then\n+\t\t\t\tsampler.reset()\n+\t\t\t\treturn true, \"Statistics were reset\"\n+\t\t\tend\n+\n+\t\t\treturn false, string.format(\n+\t\t\t\t\"Usage: %s\\n\" ..\n+\t\t\t\t\"Format can be one of txt, csv, lua, json (structures may be subject to change).\",\n+\t\t\t\tparam_usage\n+\t\t\t)\n+\t\tend\n+\t})\n+end\n+\n+core.log(\"action\", \"Initialize mod profiler\")","path":"builtin/profiler/init.lua","position":38,"original_position":38,"commit_id":"1f0a56639f17a5e9df3a38385637bf2fde8306e3","original_commit_id":"1f0a56639f17a5e9df3a38385637bf2fde8306e3","user":{"login":"est31","id":8872119,"avatar_url":"https://avatars.githubusercontent.com/u/8872119?v=3","gravatar_id":"","url":"https://api.github.com/users/est31","html_url":"https://github.com/est31","followers_url":"https://api.github.com/users/est31/followers","following_url":"https://api.github.com/users/est31/following{/other_user}","gists_url":"https://api.github.com/users/est31/gists{/gist_id}","starred_url":"https://api.github.com/users/est31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/est31/subscriptions","organizations_url":"https://api.github.com/users/est31/orgs","repos_url":"https://api.github.com/users/est31/repos","events_url":"https://api.github.com/users/est31/events{/privacy}","received_events_url":"https://api.github.com/users/est31/received_events","type":"User","site_admin":false},"body":"Is this needed?","created_at":"2016-06-23T14:25:07Z","updated_at":"2016-06-23T14:25:07Z","html_url":"https://github.com/minetest/minetest/pull/4245#discussion_r68243865","pull_request_url":"https://api.github.com/repos/minetest/minetest/pulls/4245","_links":{"self":{"href":"https://api.github.com/repos/minetest/minetest/pulls/comments/68243865"},"html":{"href":"https://github.com/minetest/minetest/pull/4245#discussion_r68243865"},"pull_request":{"href":"https://api.github.com/repos/minetest/minetest/pulls/4245"}}},"pull_request":{"url":"https://api.github.com/repos/minetest/minetest/pulls/4245","id":74811803,"html_url":"https://github.com/minetest/minetest/pull/4245","diff_url":"https://github.com/minetest/minetest/pull/4245.diff","patch_url":"https://github.com/minetest/minetest/pull/4245.patch","issue_url":"https://api.github.com/repos/minetest/minetest/issues/4245","number":4245,"state":"open","locked":false,"title":"Builtin/profiler: Rewrite profiler to fix various issues and improve capabilities","user":{"login":"t4im","id":1937987,"avatar_url":"https://avatars.githubusercontent.com/u/1937987?v=3","gravatar_id":"","url":"https://api.github.com/users/t4im","html_url":"https://github.com/t4im","followers_url":"https://api.github.com/users/t4im/followers","following_url":"https://api.github.com/users/t4im/following{/other_user}","gists_url":"https://api.github.com/users/t4im/gists{/gist_id}","starred_url":"https://api.github.com/users/t4im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t4im/subscriptions","organizations_url":"https://api.github.com/users/t4im/orgs","repos_url":"https://api.github.com/users/t4im/repos","events_url":"https://api.github.com/users/t4im/events{/privacy}","received_events_url":"https://api.github.com/users/t4im/received_events","type":"User","site_admin":false},"body":"Mod Profiler rewrite/merge of [profiler](https://github.com/t4im/profiler/) (updated and reworked for quality)\r\n\r\nTracking issue #3849 \r\n\r\n#### Changes\r\n* Correct calculation of average values.\r\n* Reduce instrumentation overhead.\r\n* Update API monitoring (-mapgen_init,+protection_violation,+playerevent,+LBM,+on_punchplayer,+on_player_hpchange).\r\n* Fix crashes related to missing parameters for the future. *(e.g. #4220)*\r\n* Fix occasional DIV/0's.\r\n* Prevent issues caused by timetravel.  \r\n  *cause might be midnight timejump or NTP corrections*\r\n* Prevent modname clashes with internal names.\r\n* Add `/profile` command for profile-data management.\r\n* Measure each instrumentation individually and label based on registration order.\r\n* Allow labeling of ABM's and LBM's for easier classification.  \r\n  Giving several ABM's or LBM's the same label will treat them as one.  \r\n  Missing labels will be autogenerated based on name or registration order.  \r\n  *I've already added some labels to homedecor, pipeworks and technic last year; so you can already see that in action.*\r\n\r\n#### Usage\r\nUse the setting \"mod_profiling\" to enable profiling.\r\n\r\n* `/profile dump [filter]` - report statistics to STDOUT and debug.txt\r\n* `/profile print [filter]` - report statistics to in-game console\r\n* `/profile save [format [filter]]` - saves the runtime statistics to a file in your worldpath (`profile-<time>[-<filter>].<format>`)\r\n  * `txt` (default) - same treetable format as used by the dump and print commands\r\n  * `csv` - ready for spreadsheet import\r\n  * `json` - useful for adhoc D3 visualizations\r\n  * `lua` - serialized lua table of the profile-data, for adhoc scripts  \r\n* `/profile reset` - reset all gathered profile data.\r\n  This can be helpful to discard of any startup measurements that often spike during loading or to get more useful min-values.\r\n\r\n `[filter]` allows limiting the output of the data via substring/pattern matching against the modname.\r\nNote: Serialized data structures might be subject to change with changed or added measurements.  \r\n\tcsv might be the most stable, due to flat structure.\r\n\r\nI've got some incomplete changes in stash, that i kept back to not mess with the stability of this version here. But if people are interested, i might add these at a later date (things like node instrumentation, call frequency, problem markers).","created_at":"2016-06-22T16:05:45Z","updated_at":"2016-06-23T14:25:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3c5a8710a73a253be9bb6d9c836664abc3d12bc4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/minetest/minetest/pulls/4245/commits","review_comments_url":"https://api.github.com/repos/minetest/minetest/pulls/4245/comments","review_comment_url":"https://api.github.com/repos/minetest/minetest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/minetest/minetest/issues/4245/comments","statuses_url":"https://api.github.com/repos/minetest/minetest/statuses/1f0a56639f17a5e9df3a38385637bf2fde8306e3","head":{"label":"t4im:profiler-rewrite","ref":"profiler-rewrite","sha":"1f0a56639f17a5e9df3a38385637bf2fde8306e3","user":{"login":"t4im","id":1937987,"avatar_url":"https://avatars.githubusercontent.com/u/1937987?v=3","gravatar_id":"","url":"https://api.github.com/users/t4im","html_url":"https://github.com/t4im","followers_url":"https://api.github.com/users/t4im/followers","following_url":"https://api.github.com/users/t4im/following{/other_user}","gists_url":"https://api.github.com/users/t4im/gists{/gist_id}","starred_url":"https://api.github.com/users/t4im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t4im/subscriptions","organizations_url":"https://api.github.com/users/t4im/orgs","repos_url":"https://api.github.com/users/t4im/repos","events_url":"https://api.github.com/users/t4im/events{/privacy}","received_events_url":"https://api.github.com/users/t4im/received_events","type":"User","site_admin":false},"repo":{"id":61667041,"name":"minetest","full_name":"t4im/minetest","owner":{"login":"t4im","id":1937987,"avatar_url":"https://avatars.githubusercontent.com/u/1937987?v=3","gravatar_id":"","url":"https://api.github.com/users/t4im","html_url":"https://github.com/t4im","followers_url":"https://api.github.com/users/t4im/followers","following_url":"https://api.github.com/users/t4im/following{/other_user}","gists_url":"https://api.github.com/users/t4im/gists{/gist_id}","starred_url":"https://api.github.com/users/t4im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t4im/subscriptions","organizations_url":"https://api.github.com/users/t4im/orgs","repos_url":"https://api.github.com/users/t4im/repos","events_url":"https://api.github.com/users/t4im/events{/privacy}","received_events_url":"https://api.github.com/users/t4im/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/t4im/minetest","description":"Minetest, an open source infinite-world block sandbox game with survival and crafting. [also https://github.com/minetest/minetest_game]","fork":true,"url":"https://api.github.com/repos/t4im/minetest","forks_url":"https://api.github.com/repos/t4im/minetest/forks","keys_url":"https://api.github.com/repos/t4im/minetest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/t4im/minetest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/t4im/minetest/teams","hooks_url":"https://api.github.com/repos/t4im/minetest/hooks","issue_events_url":"https://api.github.com/repos/t4im/minetest/issues/events{/number}","events_url":"https://api.github.com/repos/t4im/minetest/events","assignees_url":"https://api.github.com/repos/t4im/minetest/assignees{/user}","branches_url":"https://api.github.com/repos/t4im/minetest/branches{/branch}","tags_url":"https://api.github.com/repos/t4im/minetest/tags","blobs_url":"https://api.github.com/repos/t4im/minetest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/t4im/minetest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/t4im/minetest/git/refs{/sha}","trees_url":"https://api.github.com/repos/t4im/minetest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/t4im/minetest/statuses/{sha}","languages_url":"https://api.github.com/repos/t4im/minetest/languages","stargazers_url":"https://api.github.com/repos/t4im/minetest/stargazers","contributors_url":"https://api.github.com/repos/t4im/minetest/contributors","subscribers_url":"https://api.github.com/repos/t4im/minetest/subscribers","subscription_url":"https://api.github.com/repos/t4im/minetest/subscription","commits_url":"https://api.github.com/repos/t4im/minetest/commits{/sha}","git_commits_url":"https://api.github.com/repos/t4im/minetest/git/commits{/sha}","comments_url":"https://api.github.com/repos/t4im/minetest/comments{/number}","issue_comment_url":"https://api.github.com/repos/t4im/minetest/issues/comments{/number}","contents_url":"https://api.github.com/repos/t4im/minetest/contents/{+path}","compare_url":"https://api.github.com/repos/t4im/minetest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/t4im/minetest/merges","archive_url":"https://api.github.com/repos/t4im/minetest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/t4im/minetest/downloads","issues_url":"https://api.github.com/repos/t4im/minetest/issues{/number}","pulls_url":"https://api.github.com/repos/t4im/minetest/pulls{/number}","milestones_url":"https://api.github.com/repos/t4im/minetest/milestones{/number}","notifications_url":"https://api.github.com/repos/t4im/minetest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/t4im/minetest/labels{/name}","releases_url":"https://api.github.com/repos/t4im/minetest/releases{/id}","deployments_url":"https://api.github.com/repos/t4im/minetest/deployments","created_at":"2016-06-21T21:04:23Z","updated_at":"2016-06-21T21:04:27Z","pushed_at":"2016-06-23T14:08:45Z","git_url":"git://github.com/t4im/minetest.git","ssh_url":"git@github.com:t4im/minetest.git","clone_url":"https://github.com/t4im/minetest.git","svn_url":"https://github.com/t4im/minetest","homepage":"http://minetest.net/","size":42055,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"minetest:master","ref":"master","sha":"04fb10914c0d03ee77dafe610f336f23c58949ab","user":{"login":"minetest","id":2624745,"avatar_url":"https://avatars.githubusercontent.com/u/2624745?v=3","gravatar_id":"","url":"https://api.github.com/users/minetest","html_url":"https://github.com/minetest","followers_url":"https://api.github.com/users/minetest/followers","following_url":"https://api.github.com/users/minetest/following{/other_user}","gists_url":"https://api.github.com/users/minetest/gists{/gist_id}","starred_url":"https://api.github.com/users/minetest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minetest/subscriptions","organizations_url":"https://api.github.com/users/minetest/orgs","repos_url":"https://api.github.com/users/minetest/repos","events_url":"https://api.github.com/users/minetest/events{/privacy}","received_events_url":"https://api.github.com/users/minetest/received_events","type":"Organization","site_admin":false},"repo":{"id":2168780,"name":"minetest","full_name":"minetest/minetest","owner":{"login":"minetest","id":2624745,"avatar_url":"https://avatars.githubusercontent.com/u/2624745?v=3","gravatar_id":"","url":"https://api.github.com/users/minetest","html_url":"https://github.com/minetest","followers_url":"https://api.github.com/users/minetest/followers","following_url":"https://api.github.com/users/minetest/following{/other_user}","gists_url":"https://api.github.com/users/minetest/gists{/gist_id}","starred_url":"https://api.github.com/users/minetest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minetest/subscriptions","organizations_url":"https://api.github.com/users/minetest/orgs","repos_url":"https://api.github.com/users/minetest/repos","events_url":"https://api.github.com/users/minetest/events{/privacy}","received_events_url":"https://api.github.com/users/minetest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/minetest/minetest","description":"Minetest, an open source infinite-world block sandbox game with survival and crafting. [also https://github.com/minetest/minetest_game]","fork":false,"url":"https://api.github.com/repos/minetest/minetest","forks_url":"https://api.github.com/repos/minetest/minetest/forks","keys_url":"https://api.github.com/repos/minetest/minetest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/minetest/minetest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/minetest/minetest/teams","hooks_url":"https://api.github.com/repos/minetest/minetest/hooks","issue_events_url":"https://api.github.com/repos/minetest/minetest/issues/events{/number}","events_url":"https://api.github.com/repos/minetest/minetest/events","assignees_url":"https://api.github.com/repos/minetest/minetest/assignees{/user}","branches_url":"https://api.github.com/repos/minetest/minetest/branches{/branch}","tags_url":"https://api.github.com/repos/minetest/minetest/tags","blobs_url":"https://api.github.com/repos/minetest/minetest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/minetest/minetest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/minetest/minetest/git/refs{/sha}","trees_url":"https://api.github.com/repos/minetest/minetest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/minetest/minetest/statuses/{sha}","languages_url":"https://api.github.com/repos/minetest/minetest/languages","stargazers_url":"https://api.github.com/repos/minetest/minetest/stargazers","contributors_url":"https://api.github.com/repos/minetest/minetest/contributors","subscribers_url":"https://api.github.com/repos/minetest/minetest/subscribers","subscription_url":"https://api.github.com/repos/minetest/minetest/subscription","commits_url":"https://api.github.com/repos/minetest/minetest/commits{/sha}","git_commits_url":"https://api.github.com/repos/minetest/minetest/git/commits{/sha}","comments_url":"https://api.github.com/repos/minetest/minetest/comments{/number}","issue_comment_url":"https://api.github.com/repos/minetest/minetest/issues/comments{/number}","contents_url":"https://api.github.com/repos/minetest/minetest/contents/{+path}","compare_url":"https://api.github.com/repos/minetest/minetest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/minetest/minetest/merges","archive_url":"https://api.github.com/repos/minetest/minetest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/minetest/minetest/downloads","issues_url":"https://api.github.com/repos/minetest/minetest/issues{/number}","pulls_url":"https://api.github.com/repos/minetest/minetest/pulls{/number}","milestones_url":"https://api.github.com/repos/minetest/minetest/milestones{/number}","notifications_url":"https://api.github.com/repos/minetest/minetest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/minetest/minetest/labels{/name}","releases_url":"https://api.github.com/repos/minetest/minetest/releases{/id}","deployments_url":"https://api.github.com/repos/minetest/minetest/deployments","created_at":"2011-08-07T13:48:36Z","updated_at":"2016-06-23T01:22:07Z","pushed_at":"2016-06-23T14:08:46Z","git_url":"git://github.com/minetest/minetest.git","ssh_url":"git@github.com:minetest/minetest.git","clone_url":"https://github.com/minetest/minetest.git","svn_url":"https://github.com/minetest/minetest","homepage":"http://minetest.net/","size":114908,"stargazers_count":2051,"watchers_count":2051,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":650,"mirror_url":null,"open_issues_count":775,"forks":650,"open_issues":775,"watchers":2051,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/minetest/minetest/pulls/4245"},"html":{"href":"https://github.com/minetest/minetest/pull/4245"},"issue":{"href":"https://api.github.com/repos/minetest/minetest/issues/4245"},"comments":{"href":"https://api.github.com/repos/minetest/minetest/issues/4245/comments"},"review_comments":{"href":"https://api.github.com/repos/minetest/minetest/pulls/4245/comments"},"review_comment":{"href":"https://api.github.com/repos/minetest/minetest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/minetest/minetest/pulls/4245/commits"},"statuses":{"href":"https://api.github.com/repos/minetest/minetest/statuses/1f0a56639f17a5e9df3a38385637bf2fde8306e3"}}}}
{"actor":{"display_login":"est31"}}