#include <errno.h>
#include <math.h>
#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
-#include "utils_heap.h"
+#include "utils/heap/heap.h"
-#include "libcollectdclient/collectd/client.h"
-#include "libcollectdclient/collectd/network.h"
+#include "collectd/client.h"
+#include "collectd/network.h"
#define DEF_NUM_HOSTS 1000
#define DEF_NUM_PLUGINS 20
static lcc_network_t *net;
-static c_heap_t *values_heap = NULL;
+static c_heap_t *values_heap;
static struct sigaction sigint_action;
static struct sigaction sigterm_action;
-static _Bool loop = 1;
+static bool loop = true;
__attribute__((noreturn)) static void exit_usage(int exit_status) /* {{{ */
{
exit(exit_status);
} /* }}} void exit_usage */
-static void signal_handler(int signal) /* {{{ */
+static void signal_handler(int __attribute__((unused)) signal) /* {{{ */
{
- loop = 0;
+ loop = false;
} /* }}} void signal_handler */
#if HAVE_CLOCK_GETTIME
{
struct timespec ts = {0};
- if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
+ if (clock_gettime(CLOCK_REALTIME, &ts) != 0)
perror("clock_gettime");
return (double)ts.tv_sec + (double)ts.tv_nsec / 1e9;
range = max - min;
- return min + ((int)(((double)range) * ((double)random()) / (((double)RAND_MAX) + 1.0)));
+ return min + ((int)(((double)range) * ((double)random()) /
+ (((double)RAND_MAX) + 1.0)));
} /* }}} int get_boundet_random */
static lcc_value_list_t *create_value_list(void) /* {{{ */
strncpy(vl->identifier.type,
(vl->values_types[0] == LCC_TYPE_GAUGE) ? "gauge" : "derive",
sizeof(vl->identifier.type));
- vl->identifier.type[sizeof(vl->identifier.type) - 1] = 0;
+ vl->identifier.type[sizeof(vl->identifier.type) - 1] = '\0';
snprintf(vl->identifier.type_instance, sizeof(vl->identifier.type_instance),
"ti%li", random());