#else
int ret = nice(tv->thread_priority);
if (ret == -1) {
- SCLogError(SC_ERR_THREAD_NICE_PRIO, "Error setting nice value "
- "for thread %s: %s", tv->name, strerror(errno));
+ SCLogError(SC_ERR_THREAD_NICE_PRIO, "Error setting nice value %d "
+ "for thread %s: %s", tv->thread_priority, tv->name,
+ strerror(errno));
} else {
SCLogDebug("Nice value set to %"PRId32" for thread %s",
tv->thread_priority, tv->name);
TmEcode TmThreadSetupOptions(ThreadVars *tv)
{
if (tv->thread_setup_flags & THREAD_SET_AFFINITY) {
- SCLogInfo("Setting affinity for \"%s\" Module to cpu/core "
+ SCLogPerf("Setting affinity for thread \"%s\"to cpu/core "
"%"PRIu16", thread id %lu", tv->name, tv->cpu_affinity,
SCGetThreadIdLong());
SetCPUAffinity(tv->cpu_affinity);
} else {
tv->thread_priority = taf->prio;
}
- SCLogInfo("Setting prio %d for \"%s\" Module to cpu/core "
+ SCLogPerf("Setting prio %d for thread \"%s\" to cpu/core "
"%d, thread id %lu", tv->thread_priority,
tv->name, cpu, SCGetThreadIdLong());
} else {
SetCPUAffinitySet(&taf->cpu_set);
tv->thread_priority = taf->prio;
- SCLogInfo("Setting prio %d for \"%s\" thread "
- ", thread id %lu", tv->thread_priority,
+ SCLogPerf("Setting prio %d for thread \"%s\", "
+ "thread id %lu", tv->thread_priority,
tv->name, SCGetThreadIdLong());
}
TmThreadSetPrio(tv);
-/* Copyright (C) 2010 Open Information Security Foundation
+/* Copyright (C) 2010-2016 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
return;
}
-static void build_cpuset(const char *name, ConfNode *node, cpu_set_t *cpu)
+static void BuildCpuset(const char *name, ConfNode *node, cpu_set_t *cpu)
{
ConfNode *lnode;
TAILQ_FOREACH(lnode, &node->head, next) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "unknown cpu-affinity type");
exit(EXIT_FAILURE);
} else {
- SCLogInfo("Found affinity definition for \"%s\"",
- setname);
+ SCLogConfig("Found affinity definition for \"%s\"", setname);
}
CPU_ZERO(&taf->cpu_set);
if (node == NULL) {
SCLogInfo("unable to find 'cpu'");
} else {
- build_cpuset(setname, node, &taf->cpu_set);
+ BuildCpuset(setname, node, &taf->cpu_set);
}
CPU_ZERO(&taf->lowprio_cpu);
if (node == NULL) {
SCLogDebug("unable to find 'low' prio using default value");
} else {
- build_cpuset(setname, node, &taf->lowprio_cpu);
+ BuildCpuset(setname, node, &taf->lowprio_cpu);
}
node = ConfNodeLookupChild(nprio, "medium");
if (node == NULL) {
SCLogDebug("unable to find 'medium' prio using default value");
} else {
- build_cpuset(setname, node, &taf->medprio_cpu);
+ BuildCpuset(setname, node, &taf->medprio_cpu);
}
node = ConfNodeLookupChild(nprio, "high");
if (node == NULL) {
SCLogDebug("unable to find 'high' prio using default value");
} else {
- build_cpuset(setname, node, &taf->hiprio_cpu);
+ BuildCpuset(setname, node, &taf->hiprio_cpu);
}
node = ConfNodeLookupChild(nprio, "default");
if (node != NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "unknown cpu_affinity prio");
exit(EXIT_FAILURE);
}
- SCLogInfo("Using default prio '%s'", node->val);
+ SCLogConfig("Using default prio '%s' for set '%s'",
+ node->val, setname);
}
}
int AffinityGetNextCPU(ThreadsAffinityType *taf)
{
int ncpu = 0;
-
#if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__
int iter = 0;
SCMutexLock(&taf->taf_mutex);
}
}
if (iter == 2) {
- SCLogError(SC_ERR_INVALID_ARGUMENT, "cpu_set does not contain available cpus, cpu affinity conf is invalid");
+ SCLogError(SC_ERR_INVALID_ARGUMENT, "cpu_set does not contain "
+ "available cpus, cpu affinity conf is invalid");
}
taf->lcpu = ncpu + 1;
if (taf->lcpu >= UtilCpuGetNumProcessorsOnline())
taf->lcpu = 0;
SCMutexUnlock(&taf->taf_mutex);
- SCLogInfo("Setting affinity on CPU %d", ncpu);
+ SCLogDebug("Setting affinity on CPU %d", ncpu);
#endif /* OS_WIN32 and __OpenBSD__ */
return ncpu;
}