projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1856 from rubenk/snmp-dont-dispatch-values-with-empty-type-instance
[collectd.git]
/
src
/
cpufreq.c
diff --git
a/src/cpufreq.c
b/src/cpufreq.c
index
74e542b
..
1e9e857
100644
(file)
--- a/
src/cpufreq.c
+++ b/
src/cpufreq.c
@@
-21,6
+21,7
@@
**/
#include "collectd.h"
**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "common.h"
#include "plugin.h"
@@
-37,7
+38,7
@@
static int cpufreq_init (void)
while (1)
{
while (1)
{
- status = snprintf (filename, sizeof (filename),
+ status = s
s
nprintf (filename, sizeof (filename),
"/sys/devices/system/cpu/cpu%d/cpufreq/"
"scaling_cur_freq", num_cpu);
if ((status < 1) || ((unsigned int)status >= sizeof (filename)))
"/sys/devices/system/cpu/cpu%d/cpufreq/"
"scaling_cur_freq", num_cpu);
if ((status < 1) || ((unsigned int)status >= sizeof (filename)))
@@
-67,27
+68,26
@@
static void cpufreq_submit (int cpu_num, double value)
vl.values = values;
vl.values_len = 1;
vl.values = values;
vl.values_len = 1;
- vl.time = time (NULL);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "cpufreq", sizeof (vl.plugin));
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "cpufreq", sizeof (vl.plugin));
- snprintf (vl.type_instance, sizeof (vl.type_instance),
+ sstrncpy (vl.type, "cpufreq", sizeof (vl.type));
+ ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%i", cpu_num);
"%i", cpu_num);
- plugin_dispatch_values (
"cpufreq",
&vl);
+ plugin_dispatch_values (&vl);
}
static int cpufreq_read (void)
{
int status;
unsigned long long val;
}
static int cpufreq_read (void)
{
int status;
unsigned long long val;
- int i = 0;
FILE *fp;
char filename[256];
char buffer[16];
FILE *fp;
char filename[256];
char buffer[16];
- for (i = 0; i < num_cpu; i++)
+ for (i
nt i
= 0; i < num_cpu; i++)
{
{
- status = snprintf (filename, sizeof (filename),
+ status = s
s
nprintf (filename, sizeof (filename),
"/sys/devices/system/cpu/cpu%d/cpufreq/"
"scaling_cur_freq", i);
if ((status < 1) || ((unsigned int)status >= sizeof (filename)))
"/sys/devices/system/cpu/cpu%d/cpufreq/"
"scaling_cur_freq", i);
if ((status < 1) || ((unsigned int)status >= sizeof (filename)))