[libFuzzer] don't reload the corpus more than once every second
authorKostya Serebryany <kcc@google.com>
Sat, 5 Dec 2015 02:09:22 +0000 (02:09 +0000)
committerKostya Serebryany <kcc@google.com>
Sat, 5 Dec 2015 02:09:22 +0000 (02:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254824 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Fuzzer/FuzzerLoop.cpp

index ca7f82b..889c30c 100644 (file)
@@ -468,10 +468,15 @@ void Fuzzer::Drill() {
 }
 
 void Fuzzer::Loop() {
+  system_clock::time_point LastCorpusReload = system_clock::now();
   while (true) {
     size_t J1 = ChooseUnitIdxToMutate();;
     SyncCorpus();
-    RereadOutputCorpus();
+    auto Now = system_clock::now();
+    if (duration_cast<seconds>(Now - LastCorpusReload).count()) {
+      RereadOutputCorpus();
+      LastCorpusReload = Now;
+    }
     if (TotalNumberOfRuns >= Options.MaxNumberOfRuns)
       break;
     if (Options.MaxTotalTimeSec > 0 &&