summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b4415dd)
raw | patch | inline | side by side (parent: b4415dd)
author | Rinigus <rinigus.git@gmail.com> | |
Tue, 19 Jul 2016 09:20:30 +0000 (12:20 +0300) | ||
committer | Rinigus <rinigus.git@gmail.com> | |
Tue, 19 Jul 2016 09:20:30 +0000 (12:20 +0300) |
src/cpusleep.c | patch | blob | history |
diff --git a/src/cpusleep.c b/src/cpusleep.c
index bedc02a7965c33617c5e91d66cfcf4c07c4616f7..e68655012284401bfbc890a63531fca9e4cd1d33 100644 (file)
--- a/src/cpusleep.c
+++ b/src/cpusleep.c
#include "plugin.h"
#include <time.h>
-static void cpusleep_submit (derive_t cpu_sleep)
+static void cpusleep_submit(derive_t cpu_sleep)
{
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
vl.values = values;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
- sstrncpy (vl.plugin, "cpusleep", sizeof (vl.plugin));
- sstrncpy (vl.type, "cpusleep", sizeof (vl.type));
+ sstrncpy(vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy(vl.plugin, "cpusleep", sizeof (vl.plugin));
+ sstrncpy(vl.type, "cpusleep", sizeof (vl.type));
- plugin_dispatch_values (&vl);
+ plugin_dispatch_values(&vl);
}
-static int cpusleep_read (void)
+static int cpusleep_read(void)
{
struct timespec b, m;
- if ( clock_gettime(CLOCK_BOOTTIME, &b ) < 0 )
+ if ( clock_gettime(CLOCK_BOOTTIME, &b) < 0 )
{
ERROR("cpusleep plugin: clock_boottime failed");
return (-1);
}
- if ( clock_gettime(CLOCK_MONOTONIC, &m ) < 0 )
+ if ( clock_gettime(CLOCK_MONOTONIC, &m) < 0 )
{
ERROR("cpusleep plugin: clock_monotonic failed");
return (-1);
// derive is used
derive_t sleep = (derive_t) ((db-dm) * 1000);
- cpusleep_submit (sleep);
+ cpusleep_submit(sleep);
- return 0;
+ return (0);
}
-void module_register (void)
+void module_register(void)
{
- plugin_register_read ("cpusleep", cpusleep_read);
+ plugin_register_read("cpusleep", cpusleep_read);
} /* void module_register */
+
+
+/*
+ * Local variables:
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * c-indent-level: 4
+ * c-basic-offset: 2
+ * tab-width: 4
+ * End:
+ */