{"action":"created","comment":{"url":"https://api.github.com/repos/collectd/collectd/pulls/comments/74940375","id":74940375,"diff_hunk":"@@ -0,0 +1,258 @@\n+/*-\n+ * collectd - src/hugepages.c\n+ * MIT License\n+ *\n+ * Copyright(c) 2016 Intel Corporation. All rights reserved.\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\n+ * this software and associated documentation files (the \"Software\"), to deal in\n+ * the Software without restriction, including without limitation the rights to\n+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n+ * of the Software, and to permit persons to whom the Software is furnished to do\n+ * so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in all\n+ * copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n+ * SOFTWARE.\n+ *\n+ * Authors:\n+ *   Jaroslav Safka <jaroslavx.safka@intel.com>\n+ *   Kim-Marie Jones <kim-marie.jones@intel.com>\n+ */\n+\n+#include \"collectd.h\"\n+#include \"common.h\" /* auxiliary functions */\n+#include \"plugin.h\" /* plugin_register_*, plugin_dispatch_values */\n+\n+static const char g_plugin_name[] = \"hugepages\";\n+static const char g_cfg_rpt_numa[] = \"ReportPerNodeHP\";\n+static const char g_cfg_rpt_mm[] = \"ReportRootHP\";\n+\n+static const char *g_config_keys[] = {\n+  g_cfg_rpt_numa,\n+  g_cfg_rpt_mm,\n+};\n+static size_t g_config_keys_num = STATIC_ARRAY_SIZE(g_config_keys);\n+static int g_flag_rpt_numa = 1;\n+static int g_flag_rpt_mm = 1;\n+\n+struct entry_info {\n+  char *d_name;\n+  char *node;\n+};\n+\n+static int huge_config_callback(const char *key, const char *val)\n+{\n+  INFO(\"%s: HugePages config key='%s', val='%s'\", g_plugin_name, key, val);\n+\n+  if (strcasecmp(key, g_cfg_rpt_numa) == 0) {\n+    g_flag_rpt_numa = IS_TRUE(val);\n+    return 0;\n+  }\n+  if (strcasecmp(key, g_cfg_rpt_mm) == 0) {\n+    g_flag_rpt_mm = IS_TRUE(val);\n+    return 0;\n+  }\n+\n+  return -1;\n+}\n+\n+static void submit_hp(const char *plug_inst, const char *type,\n+  const char *type_instance, gauge_t free_value, gauge_t used_value)\n+{\n+  value_t values[2];\n+  value_list_t vl = VALUE_LIST_INIT;\n+\n+  values[0].gauge = free_value;\n+  values[1].gauge = used_value;\n+\n+  vl.values = values;\n+  vl.values_len = 2;\n+  sstrncpy (vl.host, hostname_g, sizeof (vl.host));\n+  sstrncpy (vl.plugin, g_plugin_name, sizeof (vl.plugin));\n+  sstrncpy (vl.plugin_instance, plug_inst, sizeof (vl.plugin_instance));\n+  sstrncpy (vl.type, type, sizeof (vl.type));\n+\n+  if (type_instance != NULL) {\n+    sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));\n+  }\n+\n+  DEBUG(\"submit_hp pl_inst:%s, inst_type %s, type %s, free=%lf, used=%lf\",\n+      plug_inst, type_instance, type, free_value, used_value);\n+\n+  plugin_dispatch_values (&vl);\n+}\n+\n+static int read_hugepage_entry(const char *path, const char *entry,\n+    void *e_info)\n+{\n+  char path2[PATH_MAX];\n+  char *type = \"hugepages\";\n+  char *partial_type_inst = \"free_used\";\n+  char type_instance[PATH_MAX];\n+  char *strin = NULL;\n+  struct entry_info *hpsize_plinst = (struct entry_info *) e_info;","path":"src/hugepages.c","position":101,"original_position":101,"commit_id":"f91506bb8f91ca3725fd3081deba4e1829186aaa","original_commit_id":"f91506bb8f91ca3725fd3081deba4e1829186aaa","user":{"login":"rubenk","id":47338,"avatar_url":"https://avatars.githubusercontent.com/u/47338?v=3","gravatar_id":"","url":"https://api.github.com/users/rubenk","html_url":"https://github.com/rubenk","followers_url":"https://api.github.com/users/rubenk/followers","following_url":"https://api.github.com/users/rubenk/following{/other_user}","gists_url":"https://api.github.com/users/rubenk/gists{/gist_id}","starred_url":"https://api.github.com/users/rubenk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubenk/subscriptions","organizations_url":"https://api.github.com/users/rubenk/orgs","repos_url":"https://api.github.com/users/rubenk/repos","events_url":"https://api.github.com/users/rubenk/events{/privacy}","received_events_url":"https://api.github.com/users/rubenk/received_events","type":"User","site_admin":false},"body":"unneccesary cast","created_at":"2016-08-16T14:03:16Z","updated_at":"2016-08-16T14:03:16Z","html_url":"https://github.com/collectd/collectd/pull/1799#discussion_r74940375","pull_request_url":"https://api.github.com/repos/collectd/collectd/pulls/1799","_links":{"self":{"href":"https://api.github.com/repos/collectd/collectd/pulls/comments/74940375"},"html":{"href":"https://github.com/collectd/collectd/pull/1799#discussion_r74940375"},"pull_request":{"href":"https://api.github.com/repos/collectd/collectd/pulls/1799"}}},"pull_request":{"url":"https://api.github.com/repos/collectd/collectd/pulls/1799","id":77833855,"html_url":"https://github.com/collectd/collectd/pull/1799","diff_url":"https://github.com/collectd/collectd/pull/1799.diff","patch_url":"https://github.com/collectd/collectd/pull/1799.patch","issue_url":"https://api.github.com/repos/collectd/collectd/issues/1799","number":1799,"state":"open","locked":false,"title":"hugepages plugin: a stats plugin for hugepages","user":{"login":"maryamtahhan","id":5012288,"avatar_url":"https://avatars.githubusercontent.com/u/5012288?v=3","gravatar_id":"","url":"https://api.github.com/users/maryamtahhan","html_url":"https://github.com/maryamtahhan","followers_url":"https://api.github.com/users/maryamtahhan/followers","following_url":"https://api.github.com/users/maryamtahhan/following{/other_user}","gists_url":"https://api.github.com/users/maryamtahhan/gists{/gist_id}","starred_url":"https://api.github.com/users/maryamtahhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maryamtahhan/subscriptions","organizations_url":"https://api.github.com/users/maryamtahhan/orgs","repos_url":"https://api.github.com/users/maryamtahhan/repos","events_url":"https://api.github.com/users/maryamtahhan/events{/privacy}","received_events_url":"https://api.github.com/users/maryamtahhan/received_events","type":"User","site_admin":false},"body":"Plugin that allows stats for hugepages to be collected.\r\n\r\nChange-Id: Ide5ff31c54206cf5ee3d6155899bd53e8edae7bd\r\nSigned-off-by: Jaroslav Safka <jaroslavx.safka@intel.com>\r\nSigned-off-by: Kim Jones <kim-marie.jones@intel.com>\r\nSigned-off-by: Maryam Tahhan <maryam.tahhan@intel.com>","created_at":"2016-07-18T16:03:32Z","updated_at":"2016-08-16T14:03:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"844ceca3799663494718732d2a21d5fb6e46d5b7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/collectd/collectd/pulls/1799/commits","review_comments_url":"https://api.github.com/repos/collectd/collectd/pulls/1799/comments","review_comment_url":"https://api.github.com/repos/collectd/collectd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/collectd/collectd/issues/1799/comments","statuses_url":"https://api.github.com/repos/collectd/collectd/statuses/f91506bb8f91ca3725fd3081deba4e1829186aaa","head":{"label":"maryamtahhan:hugepages","ref":"hugepages","sha":"f91506bb8f91ca3725fd3081deba4e1829186aaa","user":{"login":"maryamtahhan","id":5012288,"avatar_url":"https://avatars.githubusercontent.com/u/5012288?v=3","gravatar_id":"","url":"https://api.github.com/users/maryamtahhan","html_url":"https://github.com/maryamtahhan","followers_url":"https://api.github.com/users/maryamtahhan/followers","following_url":"https://api.github.com/users/maryamtahhan/following{/other_user}","gists_url":"https://api.github.com/users/maryamtahhan/gists{/gist_id}","starred_url":"https://api.github.com/users/maryamtahhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maryamtahhan/subscriptions","organizations_url":"https://api.github.com/users/maryamtahhan/orgs","repos_url":"https://api.github.com/users/maryamtahhan/repos","events_url":"https://api.github.com/users/maryamtahhan/events{/privacy}","received_events_url":"https://api.github.com/users/maryamtahhan/received_events","type":"User","site_admin":false},"repo":{"id":55240614,"name":"collectd-with-DPDK","full_name":"maryamtahhan/collectd-with-DPDK","owner":{"login":"maryamtahhan","id":5012288,"avatar_url":"https://avatars.githubusercontent.com/u/5012288?v=3","gravatar_id":"","url":"https://api.github.com/users/maryamtahhan","html_url":"https://github.com/maryamtahhan","followers_url":"https://api.github.com/users/maryamtahhan/followers","following_url":"https://api.github.com/users/maryamtahhan/following{/other_user}","gists_url":"https://api.github.com/users/maryamtahhan/gists{/gist_id}","starred_url":"https://api.github.com/users/maryamtahhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maryamtahhan/subscriptions","organizations_url":"https://api.github.com/users/maryamtahhan/orgs","repos_url":"https://api.github.com/users/maryamtahhan/repos","events_url":"https://api.github.com/users/maryamtahhan/events{/privacy}","received_events_url":"https://api.github.com/users/maryamtahhan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maryamtahhan/collectd-with-DPDK","description":"The system statistics collection daemon. Mirror of the canonical repository (updated automatically). Please send Pull Requests here!","fork":true,"url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK","forks_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/forks","keys_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/teams","hooks_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/hooks","issue_events_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/issues/events{/number}","events_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/events","assignees_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/assignees{/user}","branches_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/branches{/branch}","tags_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/tags","blobs_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/git/refs{/sha}","trees_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/statuses/{sha}","languages_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/languages","stargazers_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/stargazers","contributors_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/contributors","subscribers_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/subscribers","subscription_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/subscription","commits_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/commits{/sha}","git_commits_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/git/commits{/sha}","comments_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/comments{/number}","issue_comment_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/issues/comments{/number}","contents_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/contents/{+path}","compare_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/merges","archive_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/downloads","issues_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/issues{/number}","pulls_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/pulls{/number}","milestones_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/milestones{/number}","notifications_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/labels{/name}","releases_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/releases{/id}","deployments_url":"https://api.github.com/repos/maryamtahhan/collectd-with-DPDK/deployments","created_at":"2016-04-01T15:03:06Z","updated_at":"2016-04-04T10:51:27Z","pushed_at":"2016-08-16T13:25:14Z","git_url":"git://github.com/maryamtahhan/collectd-with-DPDK.git","ssh_url":"git@github.com:maryamtahhan/collectd-with-DPDK.git","clone_url":"https://github.com/maryamtahhan/collectd-with-DPDK.git","svn_url":"https://github.com/maryamtahhan/collectd-with-DPDK","homepage":"http://collectd.org/","size":13813,"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":"collectd:master","ref":"master","sha":"88057ccbe844a073b1426216ef2e3dff8fe87da0","user":{"login":"collectd","id":1027481,"avatar_url":"https://avatars.githubusercontent.com/u/1027481?v=3","gravatar_id":"","url":"https://api.github.com/users/collectd","html_url":"https://github.com/collectd","followers_url":"https://api.github.com/users/collectd/followers","following_url":"https://api.github.com/users/collectd/following{/other_user}","gists_url":"https://api.github.com/users/collectd/gists{/gist_id}","starred_url":"https://api.github.com/users/collectd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/collectd/subscriptions","organizations_url":"https://api.github.com/users/collectd/orgs","repos_url":"https://api.github.com/users/collectd/repos","events_url":"https://api.github.com/users/collectd/events{/privacy}","received_events_url":"https://api.github.com/users/collectd/received_events","type":"Organization","site_admin":false},"repo":{"id":3208640,"name":"collectd","full_name":"collectd/collectd","owner":{"login":"collectd","id":1027481,"avatar_url":"https://avatars.githubusercontent.com/u/1027481?v=3","gravatar_id":"","url":"https://api.github.com/users/collectd","html_url":"https://github.com/collectd","followers_url":"https://api.github.com/users/collectd/followers","following_url":"https://api.github.com/users/collectd/following{/other_user}","gists_url":"https://api.github.com/users/collectd/gists{/gist_id}","starred_url":"https://api.github.com/users/collectd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/collectd/subscriptions","organizations_url":"https://api.github.com/users/collectd/orgs","repos_url":"https://api.github.com/users/collectd/repos","events_url":"https://api.github.com/users/collectd/events{/privacy}","received_events_url":"https://api.github.com/users/collectd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/collectd/collectd","description":"The system statistics collection daemon. Mirror of the canonical repository (updated automatically). Please send Pull Requests here!","fork":false,"url":"https://api.github.com/repos/collectd/collectd","forks_url":"https://api.github.com/repos/collectd/collectd/forks","keys_url":"https://api.github.com/repos/collectd/collectd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/collectd/collectd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/collectd/collectd/teams","hooks_url":"https://api.github.com/repos/collectd/collectd/hooks","issue_events_url":"https://api.github.com/repos/collectd/collectd/issues/events{/number}","events_url":"https://api.github.com/repos/collectd/collectd/events","assignees_url":"https://api.github.com/repos/collectd/collectd/assignees{/user}","branches_url":"https://api.github.com/repos/collectd/collectd/branches{/branch}","tags_url":"https://api.github.com/repos/collectd/collectd/tags","blobs_url":"https://api.github.com/repos/collectd/collectd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/collectd/collectd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/collectd/collectd/git/refs{/sha}","trees_url":"https://api.github.com/repos/collectd/collectd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/collectd/collectd/statuses/{sha}","languages_url":"https://api.github.com/repos/collectd/collectd/languages","stargazers_url":"https://api.github.com/repos/collectd/collectd/stargazers","contributors_url":"https://api.github.com/repos/collectd/collectd/contributors","subscribers_url":"https://api.github.com/repos/collectd/collectd/subscribers","subscription_url":"https://api.github.com/repos/collectd/collectd/subscription","commits_url":"https://api.github.com/repos/collectd/collectd/commits{/sha}","git_commits_url":"https://api.github.com/repos/collectd/collectd/git/commits{/sha}","comments_url":"https://api.github.com/repos/collectd/collectd/comments{/number}","issue_comment_url":"https://api.github.com/repos/collectd/collectd/issues/comments{/number}","contents_url":"https://api.github.com/repos/collectd/collectd/contents/{+path}","compare_url":"https://api.github.com/repos/collectd/collectd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/collectd/collectd/merges","archive_url":"https://api.github.com/repos/collectd/collectd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/collectd/collectd/downloads","issues_url":"https://api.github.com/repos/collectd/collectd/issues{/number}","pulls_url":"https://api.github.com/repos/collectd/collectd/pulls{/number}","milestones_url":"https://api.github.com/repos/collectd/collectd/milestones{/number}","notifications_url":"https://api.github.com/repos/collectd/collectd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/collectd/collectd/labels{/name}","releases_url":"https://api.github.com/repos/collectd/collectd/releases{/id}","deployments_url":"https://api.github.com/repos/collectd/collectd/deployments","created_at":"2012-01-18T13:07:51Z","updated_at":"2016-08-15T18:17:26Z","pushed_at":"2016-08-16T13:35:24Z","git_url":"git://github.com/collectd/collectd.git","ssh_url":"git@github.com:collectd/collectd.git","clone_url":"https://github.com/collectd/collectd.git","svn_url":"https://github.com/collectd/collectd","homepage":"http://collectd.org/","size":27151,"stargazers_count":1223,"watchers_count":1223,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":698,"mirror_url":null,"open_issues_count":301,"forks":698,"open_issues":301,"watchers":1223,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/collectd/collectd/pulls/1799"},"html":{"href":"https://github.com/collectd/collectd/pull/1799"},"issue":{"href":"https://api.github.com/repos/collectd/collectd/issues/1799"},"comments":{"href":"https://api.github.com/repos/collectd/collectd/issues/1799/comments"},"review_comments":{"href":"https://api.github.com/repos/collectd/collectd/pulls/1799/comments"},"review_comment":{"href":"https://api.github.com/repos/collectd/collectd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/collectd/collectd/pulls/1799/commits"},"statuses":{"href":"https://api.github.com/repos/collectd/collectd/statuses/f91506bb8f91ca3725fd3081deba4e1829186aaa"}}}}
{"actor":{"display_login":"rubenk"}}