READ_FUNC(average, (inst->sum / ((gauge_t)inst->num)));
READ_FUNC(min, inst->min);
READ_FUNC(max, inst->max);
- READ_FUNC(stddev, sqrt((((gauge_t)inst->num) * inst->squares_sum) -
- (inst->sum * inst->sum)) /
- ((gauge_t)inst->num));
+ READ_FUNC(stddev,
+ sqrt((((gauge_t)inst->num) * inst->squares_sum) -
+ (inst->sum * inst->sum)) /
+ ((gauge_t)inst->num));
}
/* Reset internal state. */
/* callback = */ apache_read_host,
/* interval = */ 0,
&(user_data_t){
- .data = st,
- .free_func = apache_free,
+ .data = st, .free_func = apache_free,
});
} /* int config_add */
typedef struct temperature_list_s {
char *sensor_name; /**< sensor name/reference */
size_t num_values; /**< number of values (usually one) */
- bool initialized; /**< sensor already provides data */
+ bool initialized; /**< sensor already provides data */
struct temperature_list_s *next; /**< next in the list */
} temperature_list_t;
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L);
#ifdef HAVE_CURLOPT_TIMEOUT_MS
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS,
- (timeout >= 0)
- ? (long)timeout
- : (long)CDTIME_T_TO_MS(plugin_get_interval()));
+ (timeout >= 0) ? (long)timeout : (long)CDTIME_T_TO_MS(
+ plugin_get_interval()));
#endif
return 0;
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) /* {{{ */
* Florian octo Forster <octo at collectd.org>
*/
-#include "common.h" /* for STATIC_ARRAY_SIZE */
#include "collectd.h"
+#include "common.h" /* for STATIC_ARRAY_SIZE */
+
#include "meta_data.h"
#include "testing.h"
int uc_get_rate_by_name(const char *name, gauge_t **ret_values,
size_t *ret_values_num);
gauge_t *uc_get_rate(const data_set_t *ds, const value_list_t *vl);
-int uc_get_value_by_name(const char *name, value_t **ret_values, size_t *ret_values_num);
+int uc_get_value_by_name(const char *name, value_t **ret_values,
+ size_t *ret_values_num);
value_t *uc_get_value(const data_set_t *ds, const value_list_t *vl);
size_t uc_get_size(void);
#include "collectd/network_parse.h" /* for lcc_network_parse_options_t */
#include "collectd/server.h"
+// clang-format off
#include <errno.h>
#include <stdbool.h>
#include <string.h>
#include <net/if.h>
#include <netdb.h>
#include <netinet/in.h>
+// clang-format on
#include <stdio.h>
#define DEBUG(...) printf(__VA_ARGS__)
/* OVS events configuration data */
struct ovs_events_config_s {
- bool send_notification; /* sent notification to collectd? */
+ bool send_notification; /* sent notification to collectd? */
char ovs_db_node[OVS_DB_ADDR_NODE_SIZE]; /* OVS DB node */
char ovs_db_serv[OVS_DB_ADDR_SERVICE_SIZE]; /* OVS DB service */
char ovs_db_unix[OVS_DB_ADDR_UNIX_SIZE]; /* OVS DB unix socket path */
ovs_db_t *ovs_db; /* pointer to OVS DB instance */
ovs_events_config_t config; /* plugin config */
char *ovs_db_select_params; /* OVS DB select parameter request */
- bool is_db_available; /* specify whether OVS DB is available */
+ bool is_db_available; /* specify whether OVS DB is available */
};
typedef struct ovs_events_ctx_s ovs_events_ctx_t;
for (size_t i = 0; i < ds->ds_num; ++i) {
tuple = PyTuple_New(4);
PyTuple_SET_ITEM(tuple, 0, cpy_string_to_unicode_or_bytes(ds->ds[i].name));
- PyTuple_SET_ITEM(
- tuple, 1,
- cpy_string_to_unicode_or_bytes(DS_TYPE_TO_STRING(ds->ds[i].type)));
+ PyTuple_SET_ITEM(tuple, 1, cpy_string_to_unicode_or_bytes(
+ DS_TYPE_TO_STRING(ds->ds[i].type)));
PyTuple_SET_ITEM(tuple, 2, float_or_none(ds->ds[i].min));
PyTuple_SET_ITEM(tuple, 3, float_or_none(ds->ds[i].max));
PyList_SET_ITEM(list, i, tuple);
register_function(buf, handler,
&(user_data_t){
- .data = c,
- .free_func = cpy_destroy_user_data,
+ .data = c, .free_func = cpy_destroy_user_data,
});
++cpy_num_callbacks;
/* group = */ "python", buf, cpy_read_callback,
DOUBLE_TO_CDTIME_T(interval),
&(user_data_t){
- .data = c,
- .free_func = cpy_destroy_user_data,
+ .data = c, .free_func = cpy_destroy_user_data,
});
++cpy_num_callbacks;
return cpy_string_to_unicode_or_bytes(buf);
values = PyTuple_New(ci->values_num); /* New reference. */
for (int i = 0; i < ci->values_num; ++i) {
if (ci->values[i].type == OCONFIG_TYPE_STRING) {
- PyTuple_SET_ITEM(
- values, i,
- cpy_string_to_unicode_or_bytes(ci->values[i].value.string));
+ PyTuple_SET_ITEM(values, i, cpy_string_to_unicode_or_bytes(
+ ci->values[i].value.string));
} else if (ci->values[i].type == OCONFIG_TYPE_NUMBER) {
PyTuple_SET_ITEM(values, i,
PyFloat_FromDouble(ci->values[i].value.number));
CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_signed_int, int64_t) \
CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_unsigned_int, uint64_t) \
CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_double, double) \
- CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_boolean, bool) \
+ CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_boolean, bool) \
\
static cpy_build_meta_handler_t cpy_##func_prefix = { \
.add_string = cpy_##func_prefix##_add_string, \
}
static bool tcsv_check_index(ssize_t index, size_t fields_num,
- char const *name) {
+ char const *name) {
if (index < 0)
return 1;
else if (((size_t)index) < fields_num)
#define OK1(cond, text) \
do { \
- bool result = (cond); \
+ bool result = (cond); \
LOG(result, text); \
if (!result) { \
return -1; \
* Private functions
*/
static bool lu_part_matches(part_match_t const *match, /* {{{ */
- char const *str) {
+ char const *str) {
if (match->is_regex) {
/* Short cut popular catch-all regex. */
if (strcmp(".*", match->str) == 0)
char const *accept = MHD_lookup_connection_value(connection, MHD_HEADER_KIND,
MHD_HTTP_HEADER_ACCEPT);
- bool want_proto =
- (accept != NULL) &&
- (strstr(accept, "application/vnd.google.protobuf") != NULL);
+ bool want_proto = (accept != NULL) &&
+ (strstr(accept, "application/vnd.google.protobuf") != NULL);
uint8_t scratch[4096] = {0};
ProtobufCBufferSimple simple = PROTOBUF_C_BUFFER_SIMPLE_INIT(scratch);