{"action":"created","comment":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/comments/85263497","pull_request_review_id":5988793,"id":85263497,"diff_hunk":"@@ -821,6 +821,13 @@ os_InRegs osEvent_type svcThreadGetInfo (osThreadId thread_id, osThreadInfo info\n     return osEvent_ret_value;\n   }\n \n+  if (osThreadInfoStackCurrent == info) {\n+    uint8_t *stack_top = (uint8_t*)ptcb->stack + ptcb->priv_stack;\n+    uint8_t *stack_ptr = (uint8_t*)ptcb->tsk_stack;\n+    ret.value.v = stack_ptr - stack_top;\n+    return osEvent_ret_value;\n+  }\n+","path":"rtos/rtx/TARGET_CORTEX_M/rt_CMSIS.c","position":10,"original_position":10,"commit_id":"0758fd99ce731a68c3be66d440279dbe5dbfd937","original_commit_id":"0758fd99ce731a68c3be66d440279dbe5dbfd937","user":{"login":"geky","id":1075160,"avatar_url":"https://avatars.githubusercontent.com/u/1075160?v=3","gravatar_id":"","url":"https://api.github.com/users/geky","html_url":"https://github.com/geky","followers_url":"https://api.github.com/users/geky/followers","following_url":"https://api.github.com/users/geky/following{/other_user}","gists_url":"https://api.github.com/users/geky/gists{/gist_id}","starred_url":"https://api.github.com/users/geky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geky/subscriptions","organizations_url":"https://api.github.com/users/geky/orgs","repos_url":"https://api.github.com/users/geky/repos","events_url":"https://api.github.com/users/geky/events{/privacy}","received_events_url":"https://api.github.com/users/geky/received_events","type":"User","site_admin":false},"body":"I'm not sure I understand, is this not sufficient as a temporary implementation? All of these extensions will need to be updated with the new version of the RTOS.","created_at":"2016-10-27T04:12:55Z","updated_at":"2016-10-27T04:12:55Z","html_url":"https://github.com/ARMmbed/mbed-os/pull/3141#discussion_r85263497","pull_request_url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/3141","_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/comments/85263497"},"html":{"href":"https://github.com/ARMmbed/mbed-os/pull/3141#discussion_r85263497"},"pull_request":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/3141"}}},"pull_request":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/3141","id":91108909,"html_url":"https://github.com/ARMmbed/mbed-os/pull/3141","diff_url":"https://github.com/ARMmbed/mbed-os/pull/3141.diff","patch_url":"https://github.com/ARMmbed/mbed-os/pull/3141.patch","issue_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/3141","number":3141,"state":"open","locked":false,"title":"stats - Add cleaner stats API for stack usage","user":{"login":"geky","id":1075160,"avatar_url":"https://avatars.githubusercontent.com/u/1075160?v=3","gravatar_id":"","url":"https://api.github.com/users/geky","html_url":"https://github.com/geky","followers_url":"https://api.github.com/users/geky/followers","following_url":"https://api.github.com/users/geky/following{/other_user}","gists_url":"https://api.github.com/users/geky/gists{/gist_id}","starred_url":"https://api.github.com/users/geky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geky/subscriptions","organizations_url":"https://api.github.com/users/geky/orgs","repos_url":"https://api.github.com/users/geky/repos","events_url":"https://api.github.com/users/geky/events{/privacy}","received_events_url":"https://api.github.com/users/geky/received_events","type":"User","site_admin":false},"body":"Add clean stats api for stack usage, based on existing api for heap usage.\r\n\r\nReturns cumulative values for all stacks to keep the api simple. Stack-specific stats could be added in the future.\r\n\r\nExample:\r\n``` cpp\r\n#include \"mbed.h\"\r\n#include \"mbed_stats.h\"\r\n\r\nDigitalOut led1(LED1);\r\n\r\n// main() runs in its own thread in the OS\r\n// (note the calls to Thread::wait below for delays)\r\nint main() {\r\n    for (int i = 0; i < 5; i++) {\r\n        led1 = !led1;\r\n        Thread::wait(500);\r\n    }\r\n\r\n    mbed_stats_heap_t heap_stats;\r\n    mbed_stats_heap_get(&heap_stats);\r\n\r\n    mbed_stats_stack_t stack_stats;\r\n    mbed_stats_stack_get(&stack_stats);\r\n\r\n    printf(\"------ stats ------\\n\");\r\n\r\n    printf(\"heap current size: %ld\\n\", heap_stats.current_size);\r\n    printf(\"heap max size: %ld\\n\", heap_stats.max_size);\r\n    printf(\"heap total size: %ld\\n\", heap_stats.total_size);\r\n    printf(\"heap reserved size: %ld\\n\", heap_stats.reserved_size);\r\n    printf(\"heap alloc cnt: %ld\\n\", heap_stats.alloc_cnt);\r\n    printf(\"heap alloc fail cnt: %ld\\n\", heap_stats.alloc_fail_cnt);\r\n\r\n    printf(\"stack current size: %ld\\n\", stack_stats.current_size);\r\n    printf(\"stack max size: %ld\\n\", stack_stats.max_size);\r\n    printf(\"stack reserved size: %ld\\n\", stack_stats.reserved_size);\r\n    printf(\"stack stack cnt: %ld\\n\", stack_stats.stack_cnt);\r\n}\r\n```\r\n\r\nOutput (k64f and gcc):\r\n```\r\n------ stats ------\r\nheap current size: 0\r\nheap max size: 0\r\nheap total size: 0\r\nheap reserved size: 180104\r\nheap alloc cnt: 0\r\nheap alloc fail cnt: 0\r\nstack current size: 204\r\nstack max size: 332\r\nstack reserved size: 5408\r\nstack stack cnt: 3\r\n```\r\n\r\ntested on K64F and RZ_A1H\r\ncc @c1728p9, @bridadan ","created_at":"2016-10-26T23:36:38Z","updated_at":"2016-10-27T04:12:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe879f26281d4c327f1d000deedb379064dda2d1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/3141/commits","review_comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/3141/comments","review_comment_url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/3141/comments","statuses_url":"https://api.github.com/repos/ARMmbed/mbed-os/statuses/0758fd99ce731a68c3be66d440279dbe5dbfd937","head":{"label":"geky:stats-stack","ref":"stats-stack","sha":"0758fd99ce731a68c3be66d440279dbe5dbfd937","user":{"login":"geky","id":1075160,"avatar_url":"https://avatars.githubusercontent.com/u/1075160?v=3","gravatar_id":"","url":"https://api.github.com/users/geky","html_url":"https://github.com/geky","followers_url":"https://api.github.com/users/geky/followers","following_url":"https://api.github.com/users/geky/following{/other_user}","gists_url":"https://api.github.com/users/geky/gists{/gist_id}","starred_url":"https://api.github.com/users/geky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geky/subscriptions","organizations_url":"https://api.github.com/users/geky/orgs","repos_url":"https://api.github.com/users/geky/repos","events_url":"https://api.github.com/users/geky/events{/privacy}","received_events_url":"https://api.github.com/users/geky/received_events","type":"User","site_admin":false},"repo":{"id":59693534,"name":"mbed","full_name":"geky/mbed","owner":{"login":"geky","id":1075160,"avatar_url":"https://avatars.githubusercontent.com/u/1075160?v=3","gravatar_id":"","url":"https://api.github.com/users/geky","html_url":"https://github.com/geky","followers_url":"https://api.github.com/users/geky/followers","following_url":"https://api.github.com/users/geky/following{/other_user}","gists_url":"https://api.github.com/users/geky/gists{/gist_id}","starred_url":"https://api.github.com/users/geky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geky/subscriptions","organizations_url":"https://api.github.com/users/geky/orgs","repos_url":"https://api.github.com/users/geky/repos","events_url":"https://api.github.com/users/geky/events{/privacy}","received_events_url":"https://api.github.com/users/geky/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/geky/mbed","description":"mbed libraries and tools (Classic). For mbed OS, look here: https://www.mbed.com/en/development/software/mbed-os/","fork":true,"url":"https://api.github.com/repos/geky/mbed","forks_url":"https://api.github.com/repos/geky/mbed/forks","keys_url":"https://api.github.com/repos/geky/mbed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geky/mbed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geky/mbed/teams","hooks_url":"https://api.github.com/repos/geky/mbed/hooks","issue_events_url":"https://api.github.com/repos/geky/mbed/issues/events{/number}","events_url":"https://api.github.com/repos/geky/mbed/events","assignees_url":"https://api.github.com/repos/geky/mbed/assignees{/user}","branches_url":"https://api.github.com/repos/geky/mbed/branches{/branch}","tags_url":"https://api.github.com/repos/geky/mbed/tags","blobs_url":"https://api.github.com/repos/geky/mbed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geky/mbed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geky/mbed/git/refs{/sha}","trees_url":"https://api.github.com/repos/geky/mbed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geky/mbed/statuses/{sha}","languages_url":"https://api.github.com/repos/geky/mbed/languages","stargazers_url":"https://api.github.com/repos/geky/mbed/stargazers","contributors_url":"https://api.github.com/repos/geky/mbed/contributors","subscribers_url":"https://api.github.com/repos/geky/mbed/subscribers","subscription_url":"https://api.github.com/repos/geky/mbed/subscription","commits_url":"https://api.github.com/repos/geky/mbed/commits{/sha}","git_commits_url":"https://api.github.com/repos/geky/mbed/git/commits{/sha}","comments_url":"https://api.github.com/repos/geky/mbed/comments{/number}","issue_comment_url":"https://api.github.com/repos/geky/mbed/issues/comments{/number}","contents_url":"https://api.github.com/repos/geky/mbed/contents/{+path}","compare_url":"https://api.github.com/repos/geky/mbed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geky/mbed/merges","archive_url":"https://api.github.com/repos/geky/mbed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geky/mbed/downloads","issues_url":"https://api.github.com/repos/geky/mbed/issues{/number}","pulls_url":"https://api.github.com/repos/geky/mbed/pulls{/number}","milestones_url":"https://api.github.com/repos/geky/mbed/milestones{/number}","notifications_url":"https://api.github.com/repos/geky/mbed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geky/mbed/labels{/name}","releases_url":"https://api.github.com/repos/geky/mbed/releases{/id}","deployments_url":"https://api.github.com/repos/geky/mbed/deployments","created_at":"2016-05-25T19:59:10Z","updated_at":"2016-05-25T20:00:07Z","pushed_at":"2016-10-26T22:50:10Z","git_url":"git://github.com/geky/mbed.git","ssh_url":"git@github.com:geky/mbed.git","clone_url":"https://github.com/geky/mbed.git","svn_url":"https://github.com/geky/mbed","homepage":"","size":87714,"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":"ARMmbed:master","ref":"master","sha":"4198222c54fa9c127f7e9252a7ae576ddedc5551","user":{"login":"ARMmbed","id":8916057,"avatar_url":"https://avatars.githubusercontent.com/u/8916057?v=3","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"repo":{"id":8270972,"name":"mbed-os","full_name":"ARMmbed/mbed-os","owner":{"login":"ARMmbed","id":8916057,"avatar_url":"https://avatars.githubusercontent.com/u/8916057?v=3","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ARMmbed/mbed-os","description":"ARM mbed OS is a platform operating system designed for the internet of things","fork":false,"url":"https://api.github.com/repos/ARMmbed/mbed-os","forks_url":"https://api.github.com/repos/ARMmbed/mbed-os/forks","keys_url":"https://api.github.com/repos/ARMmbed/mbed-os/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ARMmbed/mbed-os/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ARMmbed/mbed-os/teams","hooks_url":"https://api.github.com/repos/ARMmbed/mbed-os/hooks","issue_events_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/events{/number}","events_url":"https://api.github.com/repos/ARMmbed/mbed-os/events","assignees_url":"https://api.github.com/repos/ARMmbed/mbed-os/assignees{/user}","branches_url":"https://api.github.com/repos/ARMmbed/mbed-os/branches{/branch}","tags_url":"https://api.github.com/repos/ARMmbed/mbed-os/tags","blobs_url":"https://api.github.com/repos/ARMmbed/mbed-os/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ARMmbed/mbed-os/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ARMmbed/mbed-os/git/refs{/sha}","trees_url":"https://api.github.com/repos/ARMmbed/mbed-os/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ARMmbed/mbed-os/statuses/{sha}","languages_url":"https://api.github.com/repos/ARMmbed/mbed-os/languages","stargazers_url":"https://api.github.com/repos/ARMmbed/mbed-os/stargazers","contributors_url":"https://api.github.com/repos/ARMmbed/mbed-os/contributors","subscribers_url":"https://api.github.com/repos/ARMmbed/mbed-os/subscribers","subscription_url":"https://api.github.com/repos/ARMmbed/mbed-os/subscription","commits_url":"https://api.github.com/repos/ARMmbed/mbed-os/commits{/sha}","git_commits_url":"https://api.github.com/repos/ARMmbed/mbed-os/git/commits{/sha}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/comments{/number}","issue_comment_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/comments{/number}","contents_url":"https://api.github.com/repos/ARMmbed/mbed-os/contents/{+path}","compare_url":"https://api.github.com/repos/ARMmbed/mbed-os/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ARMmbed/mbed-os/merges","archive_url":"https://api.github.com/repos/ARMmbed/mbed-os/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ARMmbed/mbed-os/downloads","issues_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues{/number}","pulls_url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls{/number}","milestones_url":"https://api.github.com/repos/ARMmbed/mbed-os/milestones{/number}","notifications_url":"https://api.github.com/repos/ARMmbed/mbed-os/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ARMmbed/mbed-os/labels{/name}","releases_url":"https://api.github.com/repos/ARMmbed/mbed-os/releases{/id}","deployments_url":"https://api.github.com/repos/ARMmbed/mbed-os/deployments","created_at":"2013-02-18T15:23:11Z","updated_at":"2016-10-27T03:00:16Z","pushed_at":"2016-10-26T23:36:38Z","git_url":"git://github.com/ARMmbed/mbed-os.git","ssh_url":"git@github.com:ARMmbed/mbed-os.git","clone_url":"https://github.com/ARMmbed/mbed-os.git","svn_url":"https://github.com/ARMmbed/mbed-os","homepage":"https://mbed.com","size":108115,"stargazers_count":789,"watchers_count":789,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":788,"mirror_url":null,"open_issues_count":402,"forks":788,"open_issues":402,"watchers":789,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/3141"},"html":{"href":"https://github.com/ARMmbed/mbed-os/pull/3141"},"issue":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/issues/3141"},"comments":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/issues/3141/comments"},"review_comments":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/3141/comments"},"review_comment":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/3141/commits"},"statuses":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/statuses/0758fd99ce731a68c3be66d440279dbe5dbfd937"}}}}
{"actor":{"display_login":"geky"}}