aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Core/StatsTracker.cpp
diff options
context:
space:
mode:
authorJulian Büning <julian.buening@rwth-aachen.de>2018-10-03 14:42:37 +0200
committerCristian Cadar <c.cadar@imperial.ac.uk>2018-10-23 18:57:53 +0300
commit2b34877c5dbf24eabf331a124b1e68d901a72cba (patch)
tree4d6f4a753d9d36a18c482cf0c8d4b8dc550bafb8 /lib/Core/StatsTracker.cpp
parentd032742a963e7d8e83dad509dd1c95b4e1a34436 (diff)
downloadklee-2b34877c5dbf24eabf331a124b1e68d901a72cba.tar.gz
refactor klee_open_output_file to return std::unique_ptr
and introduce klee_open_compressed_output_file with similar behavior along some other minor improvements
Diffstat (limited to 'lib/Core/StatsTracker.cpp')
-rw-r--r--lib/Core/StatsTracker.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp
index 6ad5b89f..dee14e61 100644
--- a/lib/Core/StatsTracker.cpp
+++ b/lib/Core/StatsTracker.cpp
@@ -176,8 +176,6 @@ StatsTracker::StatsTracker(Executor &_executor, std::string _objectFilename,
bool _updateMinDistToUncovered)
: executor(_executor),
objectFilename(_objectFilename),
- statsFile(0),
- istatsFile(0),
startWallTime(util::getWallTime()),
numBranches(0),
fullBranches(0),
@@ -243,12 +241,15 @@ StatsTracker::StatsTracker(Executor &_executor, std::string _objectFilename,
if (OutputStats) {
statsFile = executor.interpreterHandler->openOutputFile("run.stats");
- assert(statsFile && "unable to open statistics trace file");
- writeStatsHeader();
- writeStatsLine();
+ if (statsFile) {
+ writeStatsHeader();
+ writeStatsLine();
- if (StatsWriteInterval > 0)
- executor.addTimer(new WriteStatsTimer(this), StatsWriteInterval);
+ if (StatsWriteInterval > 0)
+ executor.addTimer(new WriteStatsTimer(this), StatsWriteInterval);
+ } else {
+ klee_error("Unable to open statistics trace file (run.stats).");
+ }
}
// Add timer to calculate uncovered instructions if needed by the solver
@@ -259,18 +260,15 @@ StatsTracker::StatsTracker(Executor &_executor, std::string _objectFilename,
if (OutputIStats) {
istatsFile = executor.interpreterHandler->openOutputFile("run.istats");
- assert(istatsFile && "unable to open istats file");
-
- if (IStatsWriteInterval > 0)
- executor.addTimer(new WriteIStatsTimer(this), IStatsWriteInterval);
+ if (istatsFile) {
+ if (IStatsWriteInterval > 0)
+ executor.addTimer(new WriteIStatsTimer(this), IStatsWriteInterval);
+ } else {
+ klee_error("Unable to open instruction level stats file (run.istats).");
+ }
}
}
-StatsTracker::~StatsTracker() {
- delete statsFile;
- delete istatsFile;
-}
-
void StatsTracker::done() {
if (statsFile)
writeStatsLine();
@@ -278,7 +276,8 @@ void StatsTracker::done() {
if (OutputIStats) {
if (updateMinDistToUncovered)
computeReachableUncovered();
- writeIStats();
+ if (istatsFile)
+ writeIStats();
}
}