From 61d42c342d6fc002bfa0ca0e938ab5eb0509b7a0 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 15 Apr 2017 22:42:24 +0200 Subject: [PATCH] refactoring: DEFAULT_VALUES => DEFAULT_SAMPLELEN --- config.h | 4 ++-- etc/example.conf | 7 +++---- lib/nodes/websocket.c | 2 +- lib/path.c | 4 ++-- src/hook.c | 2 +- src/pipe.c | 4 ++-- src/test-cmp.c | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/config.h b/config.h index 6a5d9bd1c..44dcaf0fc 100644 --- a/config.h +++ b/config.h @@ -11,7 +11,7 @@ #pragma once /** Default number of values in a sample */ -#define DEFAULT_VALUES 64 +#define DEFAULT_SAMPLELEN 64 #define DEFAULT_QUEUELEN 1024 /** Number of hugepages which are requested from the the kernel. @@ -30,7 +30,7 @@ #define USER_AGENT "VILLASnode (" BUILDID ")" -/*ID Required kernel version */ +/* Required kernel version */ #define KERNEL_VERSION_MAJ 3 #define KERNEL_VERSION_MIN 6 diff --git a/etc/example.conf b/etc/example.conf index e5dc28f83..37ee14d74 100644 --- a/etc/example.conf +++ b/etc/example.conf @@ -143,10 +143,9 @@ paths = ( rate = 100, # Send message over this path with a fixed (constant) rate (default: 0). # Setting this value to 0 will disable this feature. - - poolsize = 30 # The amount of samples which are kept in a circular buffer. - # This number must be larger than the 'vectorize' settings of all - # associated input and output nodes! + + queuelen = 128, + samplelen = 64 }, { enabled = false, diff --git a/lib/nodes/websocket.c b/lib/nodes/websocket.c index 5c7ee48eb..27c44ceeb 100644 --- a/lib/nodes/websocket.c +++ b/lib/nodes/websocket.c @@ -268,7 +268,7 @@ int websocket_start(struct node *n) int ret; struct websocket *w = n->_vd; - size_t blocklen = LWS_PRE + WEBMSG_LEN(DEFAULT_VALUES); + size_t blocklen = LWS_PRE + WEBMSG_LEN(DEFAULT_SAMPLELEN); ret = pool_init(&w->pool, 64 * DEFAULT_QUEUELEN, blocklen, &memtype_hugepage); if (ret) diff --git a/lib/path.c b/lib/path.c index 78befd321..a34690f0a 100644 --- a/lib/path.c +++ b/lib/path.c @@ -167,7 +167,7 @@ int path_init(struct path *p, struct super_node *sn) p->reverse = 0; p->enabled = 1; - p->samplelen = DEFAULT_VALUES; + p->samplelen = DEFAULT_SAMPLELEN; p->queuelen = DEFAULT_QUEUELEN; p->super_node = sn; @@ -221,7 +221,7 @@ int path_parse(struct path *p, config_setting_t *cfg, struct list *nodes) config_setting_lookup_bool(cfg, "reverse", &p->reverse); config_setting_lookup_bool(cfg, "enabled", &p->enabled); - config_setting_lookup_int(cfg, "values", &p->samplelen); + config_setting_lookup_int(cfg, "samplelen", &p->samplelen); config_setting_lookup_int(cfg, "queuelen", &p->queuelen); if (!IS_POW2(p->queuelen)) { diff --git a/src/hook.c b/src/hook.c index 6b000a376..cc7a5905b 100644 --- a/src/hook.c +++ b/src/hook.c @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) if (cnt < 1) error("Vectorize option must be greater than 0"); - ret = pool_init(&q, 10 * cnt, SAMPLE_LEN(DEFAULT_VALUES), &memtype_hugepage); + ret = pool_init(&q, 10 * cnt, SAMPLE_LEN(DEFAULT_SAMPLELEN), &memtype_hugepage); if (ret) error("Failed to initilize memory pool"); diff --git a/src/pipe.c b/src/pipe.c index fcb1f0382..5ae241dfc 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -95,7 +95,7 @@ static void * send_loop(void *ctx) sendd.started = true; /* Initialize memory */ - ret = pool_init(&sendd.pool, LOG2_CEIL(node->vectorize), SAMPLE_LEN(DEFAULT_VALUES), &memtype_hugepage); + ret = pool_init(&sendd.pool, LOG2_CEIL(node->vectorize), SAMPLE_LEN(DEFAULT_SAMPLELEN), &memtype_hugepage); if (ret < 0) error("Failed to allocate memory for receive pool."); @@ -142,7 +142,7 @@ static void * recv_loop(void *ctx) recvv.started = true; /* Initialize memory */ - ret = pool_init(&recvv.pool, LOG2_CEIL(node->vectorize), SAMPLE_LEN(DEFAULT_VALUES), &memtype_hugepage); + ret = pool_init(&recvv.pool, LOG2_CEIL(node->vectorize), SAMPLE_LEN(DEFAULT_SAMPLELEN), &memtype_hugepage); if (ret < 0) error("Failed to allocate memory for receive pool."); diff --git a/src/test-cmp.c b/src/test-cmp.c index 23b21328f..983b4aca6 100644 --- a/src/test-cmp.c +++ b/src/test-cmp.c @@ -82,7 +82,7 @@ check: if (optarg == endptr) log_init(&log, V, LOG_ALL); log_start(&log); - pool_init(&pool, 1024, SAMPLE_LEN(DEFAULT_VALUES), &memtype_heap); + pool_init(&pool, 1024, SAMPLE_LEN(DEFAULT_SAMPLELEN), &memtype_heap); sample_alloc(&pool, samples, 2); f1.sample = samples[0];