summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerUtil.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-05-12 18:51:57 +0000
committerKostya Serebryany <kcc@google.com>2015-05-12 18:51:57 +0000
commit9690fcf12eee2c91b106991b3aad7b0e65c0c1b3 (patch)
treed391f453af9fab0a907542830c43d0a2ca952400 /llvm/lib/Fuzzer/FuzzerUtil.cpp
parent4744ec6da984f155450683c4aa223678278050a7 (diff)
downloadbcm5719-llvm-9690fcf12eee2c91b106991b3aad7b0e65c0c1b3.tar.gz
bcm5719-llvm-9690fcf12eee2c91b106991b3aad7b0e65c0c1b3.zip
[lib/Fuzzer] guess the right number of workers if -jobs=N is given but -workers=M is not. Update the docs.
llvm-svn: 237163
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerUtil.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerUtil.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerUtil.cpp b/llvm/lib/Fuzzer/FuzzerUtil.cpp
index 3635f39a10d..dc7154ca385 100644
--- a/llvm/lib/Fuzzer/FuzzerUtil.cpp
+++ b/llvm/lib/Fuzzer/FuzzerUtil.cpp
@@ -61,4 +61,12 @@ void SetTimer(int Seconds) {
assert(Res == 0);
}
+int NumberOfCpuCores() {
+ FILE *F = popen("nproc", "r");
+ int N = 0;
+ fscanf(F, "%d", &N);
+ fclose(F);
+ return N;
+}
+
} // namespace fuzzer
OpenPOWER on IntegriCloud