projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-3.11'
[collectd.git]
/
src
/
cpufreq.c
diff --git
a/src/cpufreq.c
b/src/cpufreq.c
index
008ef39
..
7a5c8fd
100644
(file)
--- a/
src/cpufreq.c
+++ b/
src/cpufreq.c
@@
-32,16
+32,6
@@
# define CPUFREQ_HAVE_READ 0
#endif
# define CPUFREQ_HAVE_READ 0
#endif
-static data_source_t data_source[1] =
-{
- {"value", DS_TYPE_GAUGE, 0, NAN}
-};
-
-static data_set_t data_set =
-{
- "cpufreq", 1, data_source
-};
-
#if CPUFREQ_HAVE_READ
#ifdef KERNEL_LINUX
static int num_cpu = 0;
#if CPUFREQ_HAVE_READ
#ifdef KERNEL_LINUX
static int num_cpu = 0;
@@
-69,7
+59,7
@@
static int cpufreq_init (void)
num_cpu++;
}
num_cpu++;
}
-
syslog (LOG_INFO,
"cpufreq plugin: Found %d CPU%s", num_cpu,
+
INFO (
"cpufreq plugin: Found %d CPU%s", num_cpu,
(num_cpu == 1) ? "" : "s");
if (num_cpu == 0)
(num_cpu == 1) ? "" : "s");
if (num_cpu == 0)
@@
-117,19
+107,31
@@
static int cpufreq_read (void)
if ((fp = fopen (filename, "r")) == NULL)
{
if ((fp = fopen (filename, "r")) == NULL)
{
- syslog (LOG_WARNING, "cpufreq: fopen: %s", strerror (errno));
+ char errbuf[1024];
+ WARNING ("cpufreq: fopen (%s): %s", filename,
+ sstrerror (errno, errbuf,
+ sizeof (errbuf)));
return (-1);
}
if (fgets (buffer, 16, fp) == NULL)
{
return (-1);
}
if (fgets (buffer, 16, fp) == NULL)
{
- syslog (LOG_WARNING, "cpufreq: fgets: %s", strerror (errno));
+ char errbuf[1024];
+ WARNING ("cpufreq: fgets: %s",
+ sstrerror (errno, errbuf,
+ sizeof (errbuf)));
fclose (fp);
return (-1);
}
if (fclose (fp))
fclose (fp);
return (-1);
}
if (fclose (fp))
- syslog (LOG_WARNING, "cpufreq: fclose: %s", strerror (errno));
+ {
+ char errbuf[1024];
+ WARNING ("cpufreq: fclose: %s",
+ sstrerror (errno, errbuf,
+ sizeof (errbuf)));
+ }
+
/* You're seeing correctly: The file is reporting kHz values.. */
val = atoll (buffer) * 1000;
/* You're seeing correctly: The file is reporting kHz values.. */
val = atoll (buffer) * 1000;
@@
-145,8
+147,6
@@
static int cpufreq_read (void)
void module_register (void)
{
void module_register (void)
{
- plugin_register_data_set (&data_set);
-
#if CPUFREQ_HAVE_READ
plugin_register_init ("cpufreq", cpufreq_init);
plugin_register_read ("cpufreq", cpufreq_read);
#if CPUFREQ_HAVE_READ
plugin_register_init ("cpufreq", cpufreq_init);
plugin_register_read ("cpufreq", cpufreq_read);