{"action":"created","issue":{"url":"https://api.github.com/repos/libuv/libuv/issues/1815","repository_url":"https://api.github.com/repos/libuv/libuv","labels_url":"https://api.github.com/repos/libuv/libuv/issues/1815/labels{/name}","comments_url":"https://api.github.com/repos/libuv/libuv/issues/1815/comments","events_url":"https://api.github.com/repos/libuv/libuv/issues/1815/events","html_url":"https://github.com/libuv/libuv/pull/1815","id":316985748,"node_id":"MDExOlB1bGxSZXF1ZXN0MTgzNTU5NTU1","number":1815,"title":"loop,threadpool: trace events","user":{"login":"jasnell","id":439929,"node_id":"MDQ6VXNlcjQzOTkyOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/439929?v=4","gravatar_id":"","url":"https://api.github.com/users/jasnell","html_url":"https://github.com/jasnell","followers_url":"https://api.github.com/users/jasnell/followers","following_url":"https://api.github.com/users/jasnell/following{/other_user}","gists_url":"https://api.github.com/users/jasnell/gists{/gist_id}","starred_url":"https://api.github.com/users/jasnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasnell/subscriptions","organizations_url":"https://api.github.com/users/jasnell/orgs","repos_url":"https://api.github.com/users/jasnell/repos","events_url":"https://api.github.com/users/jasnell/events{/privacy}","received_events_url":"https://api.github.com/users/jasnell/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-04-23T21:14:17Z","updated_at":"2018-09-02T13:34:07Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/libuv/libuv/pulls/1815","html_url":"https://github.com/libuv/libuv/pull/1815","diff_url":"https://github.com/libuv/libuv/pull/1815.diff","patch_url":"https://github.com/libuv/libuv/pull/1815.patch"},"body":"This is an alternative take to https://github.com/libuv/libuv/pull/1764 that uses a more trace-events style API as suggested by @bnoordhuis.\r\n\r\n```c\r\nvoid start_cb(const uv_trace_info_t* info, void* data) {\r\n  switch (info->type) {\r\n    case UV_TRACE_TICK:\r\n    // ...\r\n  }\r\n}\r\n\r\nvoid end_cb(const uv_trace_info_t* info, void* data) {\r\n  switch (info->type) {\r\n    case UV_TRACE_TICK:\r\n    // ...\r\n  }\r\n}\r\n\r\nuv_loop_trace_t loop_config;\r\nloop_config.start_cb = start_cb;\r\nloop_config.end_cb = end_cb;\r\nloop_config.data = &loop;\r\n\r\nuv_loop_configure(&loop, UV_LOOP_TRACE, &loop_config);\r\n```\r\n\r\n```c\r\nvoid threadpool_trace_cb(const uv_trace_info_t* info, void* data) {\r\n  const uv_threadpool_trace_info_t* tp_info =\r\n    (const uv_threadpool_trace_info_t*)info;\r\n  // ...\r\n}\r\n\r\nuv_threadpool_trace_t tp_config;\r\nloop_config.cb = threadpool_trace_cb;\r\nloop_config.data = &loop;\r\n\r\nuv_loop_configure(&loop, UV_THREADPOOL_TRACE, &tp_config);\r\n```\r\n\r\nThis approach greatly simplifies the record keeping required in V8 and minimizes the possible ABI breakages that could occur. It would integrate quite well with V8 Trace Events in Node.js but would increase the record keeping necessary there to integrate with things like the Performance API (record keeping would still be minimal).\r\n\r\nThe `UV_LOOP_TRACE` and `UV_THREADPOOL_TRACE` configuration options are separate largely to keep internal tracking simple. Loop tracing is specific to individual loops, while the threadpool may have multiple listeners. Keeping them separate allows for greatly simplified tracking without internals getting muddy."},"comment":{"url":"https://api.github.com/repos/libuv/libuv/issues/comments/417931272","html_url":"https://github.com/libuv/libuv/pull/1815#issuecomment-417931272","issue_url":"https://api.github.com/repos/libuv/libuv/issues/1815","id":417931272,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzkzMTI3Mg==","user":{"login":"jasnell","id":439929,"node_id":"MDQ6VXNlcjQzOTkyOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/439929?v=4","gravatar_id":"","url":"https://api.github.com/users/jasnell","html_url":"https://github.com/jasnell","followers_url":"https://api.github.com/users/jasnell/followers","following_url":"https://api.github.com/users/jasnell/following{/other_user}","gists_url":"https://api.github.com/users/jasnell/gists{/gist_id}","starred_url":"https://api.github.com/users/jasnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasnell/subscriptions","organizations_url":"https://api.github.com/users/jasnell/orgs","repos_url":"https://api.github.com/users/jasnell/repos","events_url":"https://api.github.com/users/jasnell/events{/privacy}","received_events_url":"https://api.github.com/users/jasnell/received_events","type":"User","site_admin":false},"created_at":"2018-09-02T13:34:07Z","updated_at":"2018-09-02T13:34:07Z","author_association":"NONE","body":"That seems to only impact the threadpool aspect of this, not the loop tracing."}}
{"actor":{"display_login":"jasnell"}}