diff options
author | Frank Busse <bb0xfb@gmail.com> | 2019-07-30 18:45:42 +0100 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2019-10-29 15:38:02 -0400 |
commit | 4eb050e2999bef42f70dcc72a8ee283f8803ce67 (patch) | |
tree | 10b6bc4ade4040661142ae57f57639b402194152 /lib/Core/StatsTracker.cpp | |
parent | f2c9085cab7efd4468ffe44190547445fe5b15fb (diff) | |
download | klee-4eb050e2999bef42f70dcc72a8ee283f8803ce67.tar.gz |
ExecutorTimers: refactor and move to support lib
- moves timer handling from Executor into support lib - introduces TimerGroup, removes TimerInfo/WriteStatsTimer/UpdateReachableTimer/WriteIStatsTimer classes - removes ExecutorTimers.cpp and ExecutorTimerInfo.h - removes -max-instruction-time flag (see #1114)
Diffstat (limited to 'lib/Core/StatsTracker.cpp')
-rw-r--r-- | lib/Core/StatsTracker.cpp | 46 |
1 files changed, 9 insertions, 37 deletions
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp index 259a8d98..5eac2cf2 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp @@ -122,40 +122,6 @@ bool StatsTracker::useIStats() { return OutputIStats; } -namespace klee { - class WriteIStatsTimer : public Executor::Timer { - StatsTracker *statsTracker; - - public: - WriteIStatsTimer(StatsTracker *_statsTracker) : statsTracker(_statsTracker) {} - ~WriteIStatsTimer() {} - - void run() { statsTracker->writeIStats(); } - }; - - class WriteStatsTimer : public Executor::Timer { - StatsTracker *statsTracker; - - public: - WriteStatsTimer(StatsTracker *_statsTracker) : statsTracker(_statsTracker) {} - ~WriteStatsTimer() {} - - void run() { statsTracker->writeStatsLine(); } - }; - - class UpdateReachableTimer : public Executor::Timer { - StatsTracker *statsTracker; - - public: - UpdateReachableTimer(StatsTracker *_statsTracker) : statsTracker(_statsTracker) {} - - void run() { statsTracker->computeReachableUncovered(); } - }; - -} - -// - /// Check for special cases where we statically know an instruction is /// uncoverable. Currently the case is an unreachable instruction /// following a noreturn call; the instruction is really only there to @@ -297,20 +263,26 @@ StatsTracker::StatsTracker(Executor &_executor, std::string _objectFilename, writeStatsLine(); if (statsWriteInterval) - executor.addTimer(new WriteStatsTimer(this), statsWriteInterval); + executor.timers.add(std::move(std::make_unique<Timer>(statsWriteInterval, [&]{ + writeStatsLine(); + }))); } // Add timer to calculate uncovered instructions if needed by the solver if (updateMinDistToUncovered) { computeReachableUncovered(); - executor.addTimer(new UpdateReachableTimer(this), time::Span(UncoveredUpdateInterval)); + executor.timers.add(std::move(std::make_unique<Timer>(time::Span{UncoveredUpdateInterval}, [&]{ + computeReachableUncovered(); + }))); } if (OutputIStats) { istatsFile = executor.interpreterHandler->openOutputFile("run.istats"); if (istatsFile) { if (iStatsWriteInterval) - executor.addTimer(new WriteIStatsTimer(this), iStatsWriteInterval); + executor.timers.add(std::move(std::make_unique<Timer>(iStatsWriteInterval, [&]{ + writeIStats(); + }))); } else { klee_error("Unable to open instruction level stats file (run.istats)."); } |