diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2013-04-19 12:51:51 +0200 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2013-04-22 23:09:40 +0400 |
commit | 8239228efb6cd208e9aab6462521c74e6dcf7e55 (patch) | |
tree | 20f9b40279b79ec8c144ed3aef47692ae4496ffc /accel-pppd/triton | |
parent | 5a8086dd5c1ed8bd7de301e4edb4890915a922b7 (diff) | |
download | accel-ppp-8239228efb6cd208e9aab6462521c74e6dcf7e55.tar.gz accel-ppp-8239228efb6cd208e9aab6462521c74e6dcf7e55.zip |
triton: Automatic setting of thread-count parameter
Use the number of available processors to set the thread-count
option if not given in configuration file.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/triton')
-rw-r--r-- | accel-pppd/triton/triton.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/accel-pppd/triton/triton.c b/accel-pppd/triton/triton.c index 897a4ea..267cc2b 100644 --- a/accel-pppd/triton/triton.c +++ b/accel-pppd/triton/triton.c @@ -617,6 +617,14 @@ void __export triton_run() opt = conf_get_opt("core", "thread-count"); if (opt && atoi(opt) > 0) thread_count = atoi(opt); + else { + thread_count = sysconf(_SC_NPROCESSORS_ONLN); + if (thread_count < 0) { + triton_log_error("sysconf(_SC_NPROCESSORS_ONLN)" + " failed: %s\n", strerror(errno)); + thread_count = 2; + } + } opt = conf_get_opt("core", "thread-count-max"); if (opt && atoi(opt) > 0) |