From 1b1df06741db2368ed05d7589b5588edfeb68fae Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 15 Apr 2016 20:48:15 -0700 Subject: allow limiting # of cores in thread pool, useful for debugging --- src/support/threads.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/support/threads.cpp b/src/support/threads.cpp index 6edff21cb..2f558d051 100644 --- a/src/support/threads.cpp +++ b/src/support/threads.cpp @@ -117,6 +117,9 @@ void ThreadPool::initialize(size_t num) { ThreadPool* ThreadPool::get() { if (!pool) { size_t num = std::max(1U, std::thread::hardware_concurrency()); + if (getenv("BINARYEN_CORES")) { + num = std::stoi(getenv("BINARYEN_CORES")); + } pool = std::unique_ptr(new ThreadPool()); pool->initialize(num); } -- cgit v1.2.3