1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

add support to set affinity on a per path/thread basis (closes #4)

This commit is contained in:
Steffen Vogel 2020-09-13 08:36:48 +02:00
parent 85e9af4289
commit a36b93a46d
3 changed files with 10 additions and 3 deletions

2
common

@ -1 +1 @@
Subproject commit c2154f348716f1dede266204d9b4f62d505b7604
Subproject commit f0059871af74e121b2d091cb445ba0b048ba675b

View file

@ -80,6 +80,7 @@ struct vpath {
double rate; /**< A timeout for */
int enabled; /**< Is this path enabled. */
int affinity; /**< Thread affinity. */
int poll; /**< Weather or not to use poll(2). */
int reverse; /**< This path has a matching reverse path. */
int builtin; /**< This path should use built-in hooks by default. */

View file

@ -46,6 +46,7 @@
#include <villas/node.h>
#include <villas/signal.h>
#include <villas/path.h>
#include <villas/kernel/rt.hpp>
#include <villas/path_source.h>
#include <villas/path_destination.h>
@ -178,6 +179,7 @@ int path_init(struct vpath *p)
p->poll = -1;
p->queuelen = DEFAULT_QUEUE_LENGTH;
p->original_sequence_no = -1;
p->affinity = 0;
p->state = State::INITIALIZED;
@ -401,7 +403,7 @@ int path_parse(struct vpath *p, json_t *cfg, struct vlist *nodes)
if (ret)
return ret;
ret = json_unpack_ex(cfg, &err, 0, "{ s: o, s?: o, s?: o, s?: b, s?: b, s?: b, s?: i, s?: s, s?: b, s?: F, s?: o, s?: b, s?: s}",
ret = json_unpack_ex(cfg, &err, 0, "{ s: o, s?: o, s?: o, s?: b, s?: b, s?: b, s?: i, s?: s, s?: b, s?: F, s?: o, s?: b, s?: s, s?: i }",
"in", &json_in,
"out", &json_out,
"hooks", &json_hooks,
@ -414,7 +416,8 @@ int path_parse(struct vpath *p, json_t *cfg, struct vlist *nodes)
"rate", &p->rate,
"mask", &json_mask,
"original_sequence_no", &p->original_sequence_no,
"uuid", &uuid
"uuid", &uuid,
"affinity", &p->affinity
);
if (ret)
throw ConfigError(cfg, err, "node-config-path", "Failed to parse path configuration");
@ -641,6 +644,9 @@ int path_start(struct vpath *p)
if (ret)
return ret;
if (p->affinity)
kernel::rt::setThreadAffinity(p->tid, p->affinity);
return 0;
}