New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hugepages plugin: a stats plugin for hugepages #1799
Conversation
Plugin that allows stats for hugepages to be collected. Change-Id: Ide5ff31c54206cf5ee3d6155899bd53e8edae7bd Signed-off-by: Jaroslav Safka <jaroslavx.safka@intel.com> Signed-off-by: Kim Jones <kim-marie.jones@intel.com> Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Fix error: format '%lu' expects type 'long unsigned int', but argument 6 has type 'derive_t'. For line 93. Change-Id: I4f164d238cd4fa6f8a69d78b2906042aa3c5da72 Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
|
Hi @maryamtahhan, thank you very much for your patch! I'll leave some review comments inline. Best regards, |
| @@ -5971,6 +5974,7 @@ AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics] | |||
| AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin]) | |||
| AC_PLUGIN([grpc], [$with_grpc], [gRPC plugin]) | |||
| AC_PLUGIN([hddtemp], [yes], [Query hddtempd]) | |||
| AC_PLUGIN([hugepages], [yes], [Hugepages statistics]) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a Linux-only plugin, it should only be enabled when being compiled on Linux. Search configure.ac for plugin_cgroups which is a good example of how to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
@octo Thank you for the review. I will address your comments and post an update |
| @@ -128,6 +128,12 @@ Features | |||
| - hddtemp | |||
| Hard disk temperatures using hddtempd. | |||
|
|
|||
| - hugepages | |||
| Report the total number of hugpages, the number of free/reserved | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hugepages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#hugops \o/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed :)
Changed hugepage metric type and type instances.
Made a single entry in types.db for "free" and
"used" hugepages.
Calculate the used hugepages.
Removed read_syshugepage_dir; replaced with
walk_directory.
Cleared up descriptions in .pod.
Made the .conf plugin option names less cryptic.
Linux-only plugin; changed configure.ac accordingly.
Stripped function declarations and header includes
that are not used.
Tidied up globals and made some globals local.
Removed some hardcoded values and fixed spacing.
Other general tidy-ups.
Change-Id: Id0243397d3fd4ac1be90266b266341318c05c903
Signed-off-by: Kim Jones <kim-marie.jones@intel.com>
| To collect B<hugepages> information, collectd reads directories | ||
| "/sys/devices/system/node/*/hugepages" and | ||
| "/sys/kernel/mm/hugepages". | ||
| Reading of these directories can be disabled by following |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the" following options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Fix typo in .pod file. Change char * strings to static const char []. Change INFO() to DEBUG() in 1 place. Removed unnecessary initialisations & casts. Fixed ignored error returns from some funcs. Actually use result returned from pathconf(). Change-Id: I0b59af4eb8afd29141abfa9233ca1d4a8d19d0d1 Signed-off-by: Kim Jones <kim-marie.jones@intel.com>
Change-Id: Ie4ceb0ec4b55e60fcffb1d59d33a5711366eb2f7 Signed-off-by: Kim Jones <kim-marie.jones@intel.com>
| read_syshugepages(path, result->d_name); | ||
| } | ||
|
|
||
| closedir(dir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if readdir returns an error? In that case closedir is called with a NULL argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that I need to check errno here and return -1 if it is set; will add that.
However, dir is opened at line 216. closedir(dir) will still be required even if readdir fails with an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I guess in practice calling closedir with an invalid DIR * is not an issue. POSIX is silent about this, but their example uses the same code as you do: http://pubs.opengroup.org/onlinepubs/009695399/functions/closedir.html
Change-Id: Ib361b648407c7052218c1f6b9b624cb7aa799634 Signed-off-by: Kim Jones <kim-marie.jones@intel.com>
|
Thanks @kimmariejones! I have nothing more to complain about, so I think we're good to go. |
|
Thanks for your work @maryamtahhan and @kimmariejones. I've just pulled this into master and it will be part of the next collectd release due around christmas. |
|
Thanks @rubenk |
Plugin that allows stats for hugepages to be collected.
Change-Id: Ide5ff31c54206cf5ee3d6155899bd53e8edae7bd
Signed-off-by: Jaroslav Safka jaroslavx.safka@intel.com
Signed-off-by: Kim Jones kim-marie.jones@intel.com
Signed-off-by: Maryam Tahhan maryam.tahhan@intel.com