[llvm] r262754 - [libFuzzer] log less when re-loading files; fix a silly bug: when running single files actually run all of them, not just the first one
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 4 14:35:40 PST 2016
Author: kcc
Date: Fri Mar 4 16:35:40 2016
New Revision: 262754
URL: http://llvm.org/viewvc/llvm-project?rev=262754&view=rev
Log:
[libFuzzer] log less when re-loading files; fix a silly bug: when running single files actually run all of them, not just the first one
Modified:
llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp?rev=262754&r1=262753&r2=262754&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp Fri Mar 4 16:35:40 2016
@@ -346,7 +346,7 @@ static int FuzzerDriver(const std::vecto
Inputs->size(), Runs);
for (auto &Path : *Inputs) {
auto StartTime = system_clock::now();
- while (Runs-- > 0)
+ for (int Iter = 0; Iter < Runs; Iter++)
RunOneTest(&F, Path.c_str());
auto StopTime = system_clock::now();
auto MS = duration_cast<milliseconds>(StopTime - StartTime).count();
Modified: llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIO.cpp?rev=262754&r1=262753&r2=262754&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIO.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIO.cpp Fri Mar 4 16:35:40 2016
@@ -93,12 +93,14 @@ void ReadDirToVectorOfUnits(const char *
long *Epoch, size_t MaxSize) {
long E = Epoch ? *Epoch : 0;
auto Files = ListFilesInDir(Path, Epoch);
+ size_t NumLoaded = 0;
for (size_t i = 0; i < Files.size(); i++) {
auto &X = Files[i];
auto FilePath = DirPlusFile(Path, X);
if (Epoch && GetEpoch(FilePath) < E) continue;
- if ((i & (i - 1)) == 0 && i >= 1024)
- Printf("Loaded %zd/%zd files from %s\n", i, Files.size(), Path);
+ NumLoaded++;
+ if ((NumLoaded & (NumLoaded - 1)) == 0 && NumLoaded >= 1024)
+ Printf("Loaded %zd/%zd files from %s\n", NumLoaded, Files.size(), Path);
V->push_back(FileToVector(FilePath, MaxSize));
}
}
More information about the llvm-commits
mailing list