aboutsummaryrefslogtreecommitdiff
path: root/cpucount.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-02 19:26:40 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-10-02 19:28:44 +0200
commit712654d4c023a2ab13190c6905d313e0ba897965 (patch)
treeb8505b420d6621022fa6a46271340071d8881322 /cpucount.c
parentMade displayln into a library export. (diff)
downloadcalp-712654d4c023a2ab13190c6905d313e0ba897965.tar.gz
calp-712654d4c023a2ab13190c6905d313e0ba897965.tar.xz
Rewrite test running system.
Diffstat (limited to '')
-rw-r--r--cpucount.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/cpucount.c b/cpucount.c
new file mode 100644
index 00000000..2049cad0
--- /dev/null
+++ b/cpucount.c
@@ -0,0 +1,12 @@
+/**
+ Basic script for checking number of available CPU cores.
+
+ Used by tests to spawn an appropriate number of threads.
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+
+int main() {
+ printf("%i\n", sysconf(_SC_NPROCESSORS_ONLN));
+}