From 8239228efb6cd208e9aab6462521c74e6dcf7e55 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Fri, 19 Apr 2013 12:51:51 +0200 Subject: 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 --- accel-pppd/triton/triton.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'accel-pppd') diff --git a/accel-pppd/triton/triton.c b/accel-pppd/triton/triton.c index 897a4ea4..267cc2bc 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) -- cgit v1.2.3