{"action":"created","issue":{"url":"https://api.github.com/repos/ponylang/ponyc/issues/2295","repository_url":"https://api.github.com/repos/ponylang/ponyc","labels_url":"https://api.github.com/repos/ponylang/ponyc/issues/2295/labels{/name}","comments_url":"https://api.github.com/repos/ponylang/ponyc/issues/2295/comments","events_url":"https://api.github.com/repos/ponylang/ponyc/issues/2295/events","html_url":"https://github.com/ponylang/ponyc/pull/2295","id":267329389,"number":2295,"title":"Add DTrace probes for all message push and pop operations","user":{"login":"slfritchie","id":75320,"avatar_url":"https://avatars1.githubusercontent.com/u/75320?v=4","gravatar_id":"","url":"https://api.github.com/users/slfritchie","html_url":"https://github.com/slfritchie","followers_url":"https://api.github.com/users/slfritchie/followers","following_url":"https://api.github.com/users/slfritchie/following{/other_user}","gists_url":"https://api.github.com/users/slfritchie/gists{/gist_id}","starred_url":"https://api.github.com/users/slfritchie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slfritchie/subscriptions","organizations_url":"https://api.github.com/users/slfritchie/orgs","repos_url":"https://api.github.com/users/slfritchie/repos","events_url":"https://api.github.com/users/slfritchie/events{/privacy}","received_events_url":"https://api.github.com/users/slfritchie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-10-20T23:26:19Z","updated_at":"2017-12-08T16:18:20Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/ponylang/ponyc/pulls/2295","html_url":"https://github.com/ponylang/ponyc/pull/2295","diff_url":"https://github.com/ponylang/ponyc/pull/2295.diff","patch_url":"https://github.com/ponylang/ponyc/pull/2295.patch"},"body":"Existing DTrace probes for message sending & receiving / push&pop are\r\nplaced in an ad hoc fashion.  As a result, many actor messages are\r\nnot visible to DTrace.  This patch places new DTrace probes within the\r\nlowest-level code for adding & removing messages from queues.\r\n\r\nThe same queue functions are used for communication between threads.\r\nNew probes are also added to observe inter-thread communication.\r\n\r\nI've introduced C preprocessor macros to wrap the message push & pop\r\noperations.  The purposes of the macros are:\r\n\r\n* Encode the queue category into the function call: actor or thread.\r\n* Avoid cluttering the runtime's code by hiding the casting of\r\n  various args to uintptr_t.\r\n\r\nAlso added are two new scripts in the `examples/dtrace` directory:\r\n\r\n* mbox-size-all-actor-messages.d: count probe firings for actor message\r\n  pushes & pops.\r\n* mbox-size-all-thread-messages.d: count probe firings for thread message\r\n  pushes & pops.\r\n\r\nAside from adding new constants (usually via CPP macros), this patch\r\nadds a field to `struct scheduler_t` to permit reporting of which\r\nscheduler thread fires a DTrace probe.\r\n\r\nStuff I expect to get questions and/or AYFKM from reviewers `^_^` includes:\r\n\r\n* Adding new probes vs. rearranging existing ones.  (I don't want to change the meaning of existing probes unless there's extremely wide consensus that it's a good idea.)\r\n* (Ab)use of CPP macros, e.g., `ACTOR_MESSAGEQ_PUSH()` and `ACTOR_MESSAGEQ_POP()` to hide some argument casts & argument additions.  (Perhaps could use real functions and hope that inlining would do The Right Thing?)\r\n* I haven't done any performance profiling or measurement yet.  Recommendations are welcome.\r\n* I've chosen some arbitrary numeric constant values, e.g., `Q_TYPE_THREAD` and the `sched_msg_t` enum.\r\n* Whitespace/indentation and other C style stuff.\r\n\r\nI've been using [slow-actor.pony](https://gist.github.com/slfritchie/542f684da3477e576ab7bd9d2311e101) for testing on OS X Sierra/10.12.6.  Example output of the two new DTrace scripts can be found at https://gist.github.com/slfritchie/69ad5f5d00e5d02b05af9b3f117824fe and at https://gist.github.com/slfritchie/d4d30159864396d302f6f05d7fec0c89"},"comment":{"url":"https://api.github.com/repos/ponylang/ponyc/issues/comments/350304209","html_url":"https://github.com/ponylang/ponyc/pull/2295#issuecomment-350304209","issue_url":"https://api.github.com/repos/ponylang/ponyc/issues/2295","id":350304209,"user":{"login":"slfritchie","id":75320,"avatar_url":"https://avatars1.githubusercontent.com/u/75320?v=4","gravatar_id":"","url":"https://api.github.com/users/slfritchie","html_url":"https://github.com/slfritchie","followers_url":"https://api.github.com/users/slfritchie/followers","following_url":"https://api.github.com/users/slfritchie/following{/other_user}","gists_url":"https://api.github.com/users/slfritchie/gists{/gist_id}","starred_url":"https://api.github.com/users/slfritchie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slfritchie/subscriptions","organizations_url":"https://api.github.com/users/slfritchie/orgs","repos_url":"https://api.github.com/users/slfritchie/repos","events_url":"https://api.github.com/users/slfritchie/events{/privacy}","received_events_url":"https://api.github.com/users/slfritchie/received_events","type":"User","site_admin":false},"created_at":"2017-12-08T16:18:20Z","updated_at":"2017-12-08T16:18:20Z","author_association":"CONTRIBUTOR","body":"Thanks, everyone, for your helpful reviews.\r\n"}}
{"actor":{"display_login":"slfritchie"}}