Page MenuHomeFreeBSD

D56614.id176322.diff
No OneTemporary

D56614.id176322.diff

diff --git a/contrib/kyua/engine/config.cpp b/contrib/kyua/engine/config.cpp
--- a/contrib/kyua/engine/config.cpp
+++ b/contrib/kyua/engine/config.cpp
@@ -33,6 +33,9 @@
#endif
#include <stdexcept>
+#if defined(HAVE_UNISTD_H)
+# include <unistd.h>
+#endif
#include "engine/exceptions.hpp"
#include "engine/execenv/execenv.hpp"
@@ -85,10 +88,13 @@
supported.insert(execenv::default_execenv_name);
tree.set< config::strings_set_node >("execenvs", supported);
- // TODO(jmmv): Automatically derive this from the number of CPUs in the
- // machine and forcibly set to a value greater than 1. Still testing
- // the new parallel implementation as of 2015-02-27 though.
- tree.set< config::positive_int_node >("parallelism", 1);
+ long nproc = 1;
+#if defined(_SC_NPROCESSORS_ONLN)
+ /// Non-standard but works on BSD, Linux, Solaris
+ if ((nproc = sysconf(_SC_NPROCESSORS_ONLN)) < 1)
+ nproc = 1;
+#endif
+ tree.set< config::positive_int_node >("parallelism", nproc);
tree.set< config::string_node >("platform", KYUA_PLATFORM);
}

File Metadata

Mime Type
text/plain
Expires
Sat, Jul 25, 2:36 AM (11 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35459633
Default Alt Text
D56614.id176322.diff (1 KB)

Event Timeline