summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-02-05 14:20:02 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-02-06 15:22:39 -0500
commit6bb323d446e2500c5a20866b56335ac8633e1c23 (patch)
treef7d37105eef1fdf5d9e75243cfb2dc02c8d53771 /src/eval.c
parent3b82c88d1950291b1b703f082df43ec1b9654eb5 (diff)
downloadbfs-6bb323d446e2500c5a20866b56335ac8633e1c23.tar.xz
ctx: Fill in ctx->threads earlier
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/eval.c b/src/eval.c
index dfeaa1e..a4c0c11 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1515,19 +1515,6 @@ done:
return ret;
}
-static int infer_nproc(void) {
- long nproc = sysconf(_SC_NPROCESSORS_ONLN);
-
- if (nproc < 1) {
- nproc = 1;
- } else if (nproc > 8) {
- // Not much speedup after 8 threads
- nproc = 8;
- }
-
- return nproc;
-}
-
/**
* Dump the bftw() flags for -D search.
*/
@@ -1614,12 +1601,8 @@ int bfs_eval(struct bfs_ctx *ctx) {
reserve_fds(fdlimit);
fdlimit = infer_fdlimit(ctx, fdlimit);
- int nthreads;
- if (ctx->threads > 0) {
- nthreads = ctx->threads - 1;
- } else {
- nthreads = infer_nproc() - 1;
- }
+ // -1 for the main thread
+ int nthreads = ctx->threads - 1;
struct bftw_args bftw_args = {
.paths = ctx->paths,