summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerInternal.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-02-26 22:42:23 +0000
committerKostya Serebryany <kcc@google.com>2016-02-26 22:42:23 +0000
commit66ff0756e421f0d702b1eeb8debee5c8903e1540 (patch)
tree4ce50c79e614c1333e53b1adc2c35dedaea05566 /llvm/lib/Fuzzer/FuzzerInternal.h
parent4d1a0883234d00a710269bb97471d29384e9b6af (diff)
downloadbcm5719-llvm-66ff0756e421f0d702b1eeb8debee5c8903e1540.tar.gz
bcm5719-llvm-66ff0756e421f0d702b1eeb8debee5c8903e1540.zip
[libFuzzer] add -print_final_stats=1 flag
llvm-svn: 262084
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerInternal.h')
-rw-r--r--llvm/lib/Fuzzer/FuzzerInternal.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h
index 03905c2ec3a..62a77f874e3 100644
--- a/llvm/lib/Fuzzer/FuzzerInternal.h
+++ b/llvm/lib/Fuzzer/FuzzerInternal.h
@@ -85,6 +85,7 @@ std::string Hash(const Unit &U);
void SetTimer(int Seconds);
std::string Base64(const Unit &U);
int ExecuteCommand(const std::string &Command);
+size_t GetPeakRSSMb();
// Private copy of SHA1 implementation.
static const int kSHA1NumBytes = 20;
@@ -295,6 +296,7 @@ public:
bool PrintNEW = true; // Print a status line when new units are found;
bool OutputCSV = false;
bool PrintNewCovPcs = false;
+ bool PrintFinalStats = false;
};
Fuzzer(UserCallback CB, MutationDispatcher &MD, FuzzingOptions Options);
void AddToCorpus(const Unit &U) {
@@ -321,6 +323,10 @@ public:
return duration_cast<seconds>(system_clock::now() - ProcessStartTime)
.count();
}
+ size_t execPerSec() {
+ size_t Seconds = secondsSinceProcessStartUp();
+ return Seconds ? TotalNumberOfRuns / Seconds : 0;
+ }
size_t getTotalNumberOfRuns() { return TotalNumberOfRuns; }
@@ -331,6 +337,7 @@ public:
// Merge Corpora[1:] into Corpora[0].
void Merge(const std::vector<std::string> &Corpora);
MutationDispatcher &GetMD() { return MD; }
+ void PrintFinalStats();
private:
void AlarmCallback();
@@ -372,6 +379,7 @@ private:
size_t TotalNumberOfRuns = 0;
size_t TotalNumberOfExecutedTraceBasedMutations = 0;
+ size_t NumberOfNewUnitsAdded = 0;
std::vector<Unit> Corpus;
std::unordered_set<std::string> UnitHashesAddedToCorpus;
OpenPOWER on IntegriCloud