[PATCH] D43597: [libFuzzer] Reduce frequency of TEMP_MAX_LEN prints.

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 15:35:37 PST 2018


morehouse created this revision.
morehouse added a reviewer: kcc.

Only print TEMP_MAX_LEN every 10 updates if no new coverage has been
found.  If new coverage has been found, we can print more frequently.


https://reviews.llvm.org/D43597

Files:
  compiler-rt/lib/fuzzer/FuzzerInternal.h
  compiler-rt/lib/fuzzer/FuzzerLoop.cpp


Index: compiler-rt/lib/fuzzer/FuzzerLoop.cpp
===================================================================
--- compiler-rt/lib/fuzzer/FuzzerLoop.cpp
+++ compiler-rt/lib/fuzzer/FuzzerLoop.cpp
@@ -761,10 +761,14 @@
               Options.LenControl * Log(TmpMaxMutationLen)) {
         TmpMaxMutationLen =
             Min(MaxMutationLen, TmpMaxMutationLen + Log(TmpMaxMutationLen));
-        if (TmpMaxMutationLen <= MaxMutationLen)
+        if (TmpMaxMutationLen <= MaxMutationLen &&
+            TotalNumberOfRuns - LastTmpMaxPrintRun >
+                Options.LenControl * Log(TmpMaxMutationLen) * 10) {
           Printf("#%zd\tTEMP_MAX_LEN: %zd (%zd %zd)\n", TotalNumberOfRuns,
                  TmpMaxMutationLen, Options.LenControl,
                  LastCorpusUpdateRun);
+          LastTmpMaxPrintRun = TotalNumberOfRuns;
+        }
         LastCorpusUpdateRun = TotalNumberOfRuns;
       }
     } else {
Index: compiler-rt/lib/fuzzer/FuzzerInternal.h
===================================================================
--- compiler-rt/lib/fuzzer/FuzzerInternal.h
+++ compiler-rt/lib/fuzzer/FuzzerInternal.h
@@ -124,6 +124,7 @@
   size_t NumberOfNewUnitsAdded = 0;
 
   size_t LastCorpusUpdateRun = 0;
+  size_t LastTmpMaxPrintRun = 0;
 
   bool HasMoreMallocsThanFrees = false;
   size_t NumberOfLeakDetectionAttempts = 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43597.135340.patch
Type: text/x-patch
Size: 1340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180221/e504591f/attachment.bin>


More information about the llvm-commits mailing list