From 5c3701c621cf480070de72bf244939b6440be33d Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Fri, 4 Mar 2016 22:35:40 +0000 Subject: [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 llvm-svn: 262754 --- llvm/lib/Fuzzer/FuzzerDriver.cpp | 2 +- llvm/lib/Fuzzer/FuzzerIO.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Fuzzer/FuzzerDriver.cpp b/llvm/lib/Fuzzer/FuzzerDriver.cpp index 098a06ea7bb..a91d9deddb5 100644 --- a/llvm/lib/Fuzzer/FuzzerDriver.cpp +++ b/llvm/lib/Fuzzer/FuzzerDriver.cpp @@ -346,7 +346,7 @@ static int FuzzerDriver(const std::vector &Args, 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(StopTime - StartTime).count(); diff --git a/llvm/lib/Fuzzer/FuzzerIO.cpp b/llvm/lib/Fuzzer/FuzzerIO.cpp index 6773c602a76..3fa672123ed 100644 --- a/llvm/lib/Fuzzer/FuzzerIO.cpp +++ b/llvm/lib/Fuzzer/FuzzerIO.cpp @@ -93,12 +93,14 @@ void ReadDirToVectorOfUnits(const char *Path, std::vector *V, 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)); } } -- cgit v1.2.3