affinity: 'threads' param to configure threads number

This patch adds a new parameter the affinity. The 'threads' keyword
is used to set the number of threads to start for a family. It can
only be used on family where multiple thread are laucnh in the running
mode. This is mainly the case of the detect threads.

Signed-off-by: Eric Leblond <eric@regit.org>
remotes/origin/master-1.1.x
Eric Leblond 14 years ago committed by Victor Julien
parent 789d46cc3c
commit fb3641982f

@ -243,20 +243,27 @@ void AffinitySetupLoadFromConfig()
}
node = ConfNodeLookupChild(affinity->head.tqh_first, "prio");
if (node == NULL)
continue;
if (!strcmp(node->val, "low")) {
taf->prio = PRIO_LOW;
} else if (!strcmp(node->val, "medium")) {
taf->prio = PRIO_MEDIUM;
} else if (!strcmp(node->val, "high")) {
taf->prio = PRIO_HIGH;
} else {
SCLogError(SC_ERR_INVALID_ARGUMENT, "unknown cpu_affinity prio");
exit(EXIT_FAILURE);
if (node != NULL) {
if (!strcmp(node->val, "low")) {
taf->prio = PRIO_LOW;
} else if (!strcmp(node->val, "medium")) {
taf->prio = PRIO_MEDIUM;
} else if (!strcmp(node->val, "high")) {
taf->prio = PRIO_HIGH;
} else {
SCLogError(SC_ERR_INVALID_ARGUMENT, "unknown cpu_affinity prio");
exit(EXIT_FAILURE);
}
}
node = ConfNodeLookupChild(affinity->head.tqh_first, "threads");
if (node != NULL) {
taf->nb_threads = atoi(node->val);
if (! taf->nb_threads) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "bad value for threads count");
exit(EXIT_FAILURE);
}
}
}
}

@ -48,6 +48,7 @@ typedef struct ThreadsAffinityType_ {
cpu_set_t cpu_set;
uint8_t mode_flag;
uint8_t prio;
int nb_threads;
cpu_set_t lowprio_cpu;
cpu_set_t medprio_cpu;
cpu_set_t hiprio_cpu;

Loading…
Cancel
Save