summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-10-02 20:47:55 +0000
committerKostya Serebryany <kcc@google.com>2015-10-02 20:47:55 +0000
commitb85db178a08611df3c50ed6ad780cd1ee639c22f (patch)
tree2ce1217beeb7e2171a1311fd020bfebdcb764d3f /llvm/lib/Fuzzer/FuzzerLoop.cpp
parent266b38ab565c46c5cf7fcc6e106d98d7f7256ff7 (diff)
downloadbcm5719-llvm-b85db178a08611df3c50ed6ad780cd1ee639c22f.tar.gz
bcm5719-llvm-b85db178a08611df3c50ed6ad780cd1ee639c22f.zip
[libFuzzer] add a flag -max_total_time
llvm-svn: 249181
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index 96783dac673..6e04868fd40 100644
--- a/llvm/lib/Fuzzer/FuzzerLoop.cpp
+++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp
@@ -337,6 +337,10 @@ void Fuzzer::Loop() {
RereadOutputCorpus();
if (TotalNumberOfRuns >= Options.MaxNumberOfRuns)
return;
+ if (Options.MaxTotalTimeSec > 0 &&
+ secondsSinceProcessStartUp() >
+ static_cast<size_t>(Options.MaxTotalTimeSec))
+ return;
CurrentUnit = Corpus[J1];
// Optionally, cross with another unit.
if (Options.DoCrossOver && USF.GetRand().RandBool()) {
OpenPOWER on IntegriCloud