{"action":"created","comment":{"url":"https://api.github.com/repos/pocl/pocl/pulls/comments/53600560","id":53600560,"diff_hunk":"@@ -0,0 +1,299 @@\n+#include <stdio.h>\n+#include <string.h>\n+#include \"pocl_tracing.h\"\n+#include \"pocl_runtime_config.h\"\n+\n+#ifdef LTTNG_UST_AVAILABLE\n+#include \"pocl_lttng.h\"\n+#endif\n+\n+static int tracing_initialized = 0;\n+static uint8_t event_trace_filter = 0xF;\n+\n+static const char *status_to_str[] = {\n+  \"complete\",\n+  \"running\",\n+  \"submitted\",\n+  \"queued\"\n+};\n+\n+static const struct pocl_event_tracer text_logger;\n+static const struct pocl_event_tracer lttng_tracer;\n+\n+/**\n+ * List of tracers\n+ */\n+static const struct pocl_event_tracer *pocl_event_tracers[] = {\n+  &text_logger,\n+#ifdef LTTNG_UST_AVAILABLE\n+  &lttng_tracer,\n+#endif\n+};\n+\n+#define POCL_TRACER_COUNT (sizeof(pocl_event_tracers) / sizeof((pocl_event_tracers)[0]))\n+\n+static const struct pocl_event_tracer *event_tracer = NULL;\n+\n+int pocl_event_updated(cl_event event, int status)\n+{\n+  event_callback_item* cb_ptr;\n+\n+  /* event callback handling just call functions in the same order\n+   * they were added if the status match the specified one */\n+  for (cb_ptr = event->callback_list; cb_ptr; cb_ptr = cb_ptr->next)\n+    {\n+      if (cb_ptr->trigger_status == status)\n+        cb_ptr->callback_function (event, cb_ptr->trigger_status,\n+\t\t\t\t\t\t  cb_ptr->user_data);\n+    }\n+\n+  if (event_tracer && ((1 << status) & event_trace_filter))\n+    event_tracer->event_updated(event, status);\n+}\n+\n+void pocl_parse_event_filter()\n+{\n+  const char *trace_filter;\n+  char *tmp_str, *save_ptr, *token;\n+\n+  trace_filter = pocl_get_string_option(\"POCL_TRACE_EVENT_FILTER\", NULL);","path":"lib/CL/pocl_tracing.c","position":59,"original_position":59,"commit_id":"3f149f81537922852fb06277472b232691ea63cc","original_commit_id":"3f149f81537922852fb06277472b232691ea63cc","user":{"login":"pjaaskel","id":1652632,"avatar_url":"https://avatars.githubusercontent.com/u/1652632?v=3","gravatar_id":"","url":"https://api.github.com/users/pjaaskel","html_url":"https://github.com/pjaaskel","followers_url":"https://api.github.com/users/pjaaskel/followers","following_url":"https://api.github.com/users/pjaaskel/following{/other_user}","gists_url":"https://api.github.com/users/pjaaskel/gists{/gist_id}","starred_url":"https://api.github.com/users/pjaaskel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjaaskel/subscriptions","organizations_url":"https://api.github.com/users/pjaaskel/orgs","repos_url":"https://api.github.com/users/pjaaskel/repos","events_url":"https://api.github.com/users/pjaaskel/events{/privacy}","received_events_url":"https://api.github.com/users/pjaaskel/received_events","type":"User","site_admin":false},"body":"Check C style. Function call parenthesis like: func (foo).","created_at":"2016-02-22T09:18:51Z","updated_at":"2016-02-22T09:18:51Z","html_url":"https://github.com/pocl/pocl/pull/300#discussion_r53600560","pull_request_url":"https://api.github.com/repos/pocl/pocl/pulls/300","_links":{"self":{"href":"https://api.github.com/repos/pocl/pocl/pulls/comments/53600560"},"html":{"href":"https://github.com/pocl/pocl/pull/300#discussion_r53600560"},"pull_request":{"href":"https://api.github.com/repos/pocl/pocl/pulls/300"}}},"pull_request":{"url":"https://api.github.com/repos/pocl/pocl/pulls/300","id":59479566,"html_url":"https://github.com/pocl/pocl/pull/300","diff_url":"https://github.com/pocl/pocl/pull/300.diff","patch_url":"https://github.com/pocl/pocl/pull/300.patch","issue_url":"https://api.github.com/repos/pocl/pocl/issues/300","number":300,"state":"open","locked":false,"title":"clSetEventCallback & trace improvements","user":{"login":"clementleger","id":5433937,"avatar_url":"https://avatars.githubusercontent.com/u/5433937?v=3","gravatar_id":"","url":"https://api.github.com/users/clementleger","html_url":"https://github.com/clementleger","followers_url":"https://api.github.com/users/clementleger/followers","following_url":"https://api.github.com/users/clementleger/following{/other_user}","gists_url":"https://api.github.com/users/clementleger/gists{/gist_id}","starred_url":"https://api.github.com/users/clementleger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clementleger/subscriptions","organizations_url":"https://api.github.com/users/clementleger/orgs","repos_url":"https://api.github.com/users/clementleger/repos","events_url":"https://api.github.com/users/clementleger/events{/privacy}","received_events_url":"https://api.github.com/users/clementleger/received_events","type":"User","site_admin":false},"body":"This commit fixes the way clSetEventCallback should work and introduce a tracing mecanism.\r\nThis trace system can be controlled by an ENV var (POCL_TRACE_EVENT) which will log all events.\r\nThe logging itself cabn be done by multiple backend (simple text logger at the moment) but will be extending to add a lttng tracer for instance.","created_at":"2016-02-16T11:48:52Z","updated_at":"2016-02-22T09:18:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6fdd9b45af3967af8fd4a026ecccaf84ec36721e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pocl/pocl/pulls/300/commits","review_comments_url":"https://api.github.com/repos/pocl/pocl/pulls/300/comments","review_comment_url":"https://api.github.com/repos/pocl/pocl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pocl/pocl/issues/300/comments","statuses_url":"https://api.github.com/repos/pocl/pocl/statuses/3f149f81537922852fb06277472b232691ea63cc","head":{"label":"clementleger:clseteventcallback","ref":"clseteventcallback","sha":"3f149f81537922852fb06277472b232691ea63cc","user":{"login":"clementleger","id":5433937,"avatar_url":"https://avatars.githubusercontent.com/u/5433937?v=3","gravatar_id":"","url":"https://api.github.com/users/clementleger","html_url":"https://github.com/clementleger","followers_url":"https://api.github.com/users/clementleger/followers","following_url":"https://api.github.com/users/clementleger/following{/other_user}","gists_url":"https://api.github.com/users/clementleger/gists{/gist_id}","starred_url":"https://api.github.com/users/clementleger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clementleger/subscriptions","organizations_url":"https://api.github.com/users/clementleger/orgs","repos_url":"https://api.github.com/users/clementleger/repos","events_url":"https://api.github.com/users/clementleger/events{/privacy}","received_events_url":"https://api.github.com/users/clementleger/received_events","type":"User","site_admin":false},"repo":{"id":12751272,"name":"pocl","full_name":"clementleger/pocl","owner":{"login":"clementleger","id":5433937,"avatar_url":"https://avatars.githubusercontent.com/u/5433937?v=3","gravatar_id":"","url":"https://api.github.com/users/clementleger","html_url":"https://github.com/clementleger","followers_url":"https://api.github.com/users/clementleger/followers","following_url":"https://api.github.com/users/clementleger/following{/other_user}","gists_url":"https://api.github.com/users/clementleger/gists{/gist_id}","starred_url":"https://api.github.com/users/clementleger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clementleger/subscriptions","organizations_url":"https://api.github.com/users/clementleger/orgs","repos_url":"https://api.github.com/users/clementleger/repos","events_url":"https://api.github.com/users/clementleger/events{/privacy}","received_events_url":"https://api.github.com/users/clementleger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/clementleger/pocl","description":"pocl - Portable Computing Language","fork":true,"url":"https://api.github.com/repos/clementleger/pocl","forks_url":"https://api.github.com/repos/clementleger/pocl/forks","keys_url":"https://api.github.com/repos/clementleger/pocl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clementleger/pocl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clementleger/pocl/teams","hooks_url":"https://api.github.com/repos/clementleger/pocl/hooks","issue_events_url":"https://api.github.com/repos/clementleger/pocl/issues/events{/number}","events_url":"https://api.github.com/repos/clementleger/pocl/events","assignees_url":"https://api.github.com/repos/clementleger/pocl/assignees{/user}","branches_url":"https://api.github.com/repos/clementleger/pocl/branches{/branch}","tags_url":"https://api.github.com/repos/clementleger/pocl/tags","blobs_url":"https://api.github.com/repos/clementleger/pocl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clementleger/pocl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clementleger/pocl/git/refs{/sha}","trees_url":"https://api.github.com/repos/clementleger/pocl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clementleger/pocl/statuses/{sha}","languages_url":"https://api.github.com/repos/clementleger/pocl/languages","stargazers_url":"https://api.github.com/repos/clementleger/pocl/stargazers","contributors_url":"https://api.github.com/repos/clementleger/pocl/contributors","subscribers_url":"https://api.github.com/repos/clementleger/pocl/subscribers","subscription_url":"https://api.github.com/repos/clementleger/pocl/subscription","commits_url":"https://api.github.com/repos/clementleger/pocl/commits{/sha}","git_commits_url":"https://api.github.com/repos/clementleger/pocl/git/commits{/sha}","comments_url":"https://api.github.com/repos/clementleger/pocl/comments{/number}","issue_comment_url":"https://api.github.com/repos/clementleger/pocl/issues/comments{/number}","contents_url":"https://api.github.com/repos/clementleger/pocl/contents/{+path}","compare_url":"https://api.github.com/repos/clementleger/pocl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clementleger/pocl/merges","archive_url":"https://api.github.com/repos/clementleger/pocl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clementleger/pocl/downloads","issues_url":"https://api.github.com/repos/clementleger/pocl/issues{/number}","pulls_url":"https://api.github.com/repos/clementleger/pocl/pulls{/number}","milestones_url":"https://api.github.com/repos/clementleger/pocl/milestones{/number}","notifications_url":"https://api.github.com/repos/clementleger/pocl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clementleger/pocl/labels{/name}","releases_url":"https://api.github.com/repos/clementleger/pocl/releases{/id}","deployments_url":"https://api.github.com/repos/clementleger/pocl/deployments","created_at":"2013-09-11T08:22:44Z","updated_at":"2015-04-30T15:41:29Z","pushed_at":"2016-02-17T15:45:03Z","git_url":"git://github.com/clementleger/pocl.git","ssh_url":"git@github.com:clementleger/pocl.git","clone_url":"https://github.com/clementleger/pocl.git","svn_url":"https://github.com/clementleger/pocl","homepage":"http://pocl.sf.net/","size":44736,"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":"pocl:master","ref":"master","sha":"2898ca2fdbd3f43b5bb8e5110e3775e3dba51d57","user":{"login":"pocl","id":5285403,"avatar_url":"https://avatars.githubusercontent.com/u/5285403?v=3","gravatar_id":"","url":"https://api.github.com/users/pocl","html_url":"https://github.com/pocl","followers_url":"https://api.github.com/users/pocl/followers","following_url":"https://api.github.com/users/pocl/following{/other_user}","gists_url":"https://api.github.com/users/pocl/gists{/gist_id}","starred_url":"https://api.github.com/users/pocl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pocl/subscriptions","organizations_url":"https://api.github.com/users/pocl/orgs","repos_url":"https://api.github.com/users/pocl/repos","events_url":"https://api.github.com/users/pocl/events{/privacy}","received_events_url":"https://api.github.com/users/pocl/received_events","type":"Organization","site_admin":false},"repo":{"id":12292999,"name":"pocl","full_name":"pocl/pocl","owner":{"login":"pocl","id":5285403,"avatar_url":"https://avatars.githubusercontent.com/u/5285403?v=3","gravatar_id":"","url":"https://api.github.com/users/pocl","html_url":"https://github.com/pocl","followers_url":"https://api.github.com/users/pocl/followers","following_url":"https://api.github.com/users/pocl/following{/other_user}","gists_url":"https://api.github.com/users/pocl/gists{/gist_id}","starred_url":"https://api.github.com/users/pocl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pocl/subscriptions","organizations_url":"https://api.github.com/users/pocl/orgs","repos_url":"https://api.github.com/users/pocl/repos","events_url":"https://api.github.com/users/pocl/events{/privacy}","received_events_url":"https://api.github.com/users/pocl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pocl/pocl","description":"pocl - Portable Computing Language","fork":false,"url":"https://api.github.com/repos/pocl/pocl","forks_url":"https://api.github.com/repos/pocl/pocl/forks","keys_url":"https://api.github.com/repos/pocl/pocl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pocl/pocl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pocl/pocl/teams","hooks_url":"https://api.github.com/repos/pocl/pocl/hooks","issue_events_url":"https://api.github.com/repos/pocl/pocl/issues/events{/number}","events_url":"https://api.github.com/repos/pocl/pocl/events","assignees_url":"https://api.github.com/repos/pocl/pocl/assignees{/user}","branches_url":"https://api.github.com/repos/pocl/pocl/branches{/branch}","tags_url":"https://api.github.com/repos/pocl/pocl/tags","blobs_url":"https://api.github.com/repos/pocl/pocl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pocl/pocl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pocl/pocl/git/refs{/sha}","trees_url":"https://api.github.com/repos/pocl/pocl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pocl/pocl/statuses/{sha}","languages_url":"https://api.github.com/repos/pocl/pocl/languages","stargazers_url":"https://api.github.com/repos/pocl/pocl/stargazers","contributors_url":"https://api.github.com/repos/pocl/pocl/contributors","subscribers_url":"https://api.github.com/repos/pocl/pocl/subscribers","subscription_url":"https://api.github.com/repos/pocl/pocl/subscription","commits_url":"https://api.github.com/repos/pocl/pocl/commits{/sha}","git_commits_url":"https://api.github.com/repos/pocl/pocl/git/commits{/sha}","comments_url":"https://api.github.com/repos/pocl/pocl/comments{/number}","issue_comment_url":"https://api.github.com/repos/pocl/pocl/issues/comments{/number}","contents_url":"https://api.github.com/repos/pocl/pocl/contents/{+path}","compare_url":"https://api.github.com/repos/pocl/pocl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pocl/pocl/merges","archive_url":"https://api.github.com/repos/pocl/pocl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pocl/pocl/downloads","issues_url":"https://api.github.com/repos/pocl/pocl/issues{/number}","pulls_url":"https://api.github.com/repos/pocl/pocl/pulls{/number}","milestones_url":"https://api.github.com/repos/pocl/pocl/milestones{/number}","notifications_url":"https://api.github.com/repos/pocl/pocl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pocl/pocl/labels{/name}","releases_url":"https://api.github.com/repos/pocl/pocl/releases{/id}","deployments_url":"https://api.github.com/repos/pocl/pocl/deployments","created_at":"2013-08-22T09:26:12Z","updated_at":"2016-02-19T12:38:18Z","pushed_at":"2016-02-18T16:25:26Z","git_url":"git://github.com/pocl/pocl.git","ssh_url":"git@github.com:pocl/pocl.git","clone_url":"https://github.com/pocl/pocl.git","svn_url":"https://github.com/pocl/pocl","homepage":"http://portablecl.org","size":46484,"stargazers_count":136,"watchers_count":136,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":57,"mirror_url":null,"open_issues_count":30,"forks":57,"open_issues":30,"watchers":136,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pocl/pocl/pulls/300"},"html":{"href":"https://github.com/pocl/pocl/pull/300"},"issue":{"href":"https://api.github.com/repos/pocl/pocl/issues/300"},"comments":{"href":"https://api.github.com/repos/pocl/pocl/issues/300/comments"},"review_comments":{"href":"https://api.github.com/repos/pocl/pocl/pulls/300/comments"},"review_comment":{"href":"https://api.github.com/repos/pocl/pocl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pocl/pocl/pulls/300/commits"},"statuses":{"href":"https://api.github.com/repos/pocl/pocl/statuses/3f149f81537922852fb06277472b232691ea63cc"}}}}