about summary refs log tree commit diff homepage
path: root/lib/Core
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2022-01-07 14:14:38 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2023-03-23 17:41:08 +0000
commitfc3c937892998b984a59cfa740244952ff6071b9 (patch)
tree3f2a97a94de5ea0552e6f16d6becc0b8a0bb9ab6 /lib/Core
parenta91be77e800510db50444b3e1f5ef20dbca0260c (diff)
downloadklee-fc3c937892998b984a59cfa740244952ff6071b9.tar.gz
stats: add InhibitedForks
Diffstat (limited to 'lib/Core')
-rw-r--r--lib/Core/CoreStats.cpp1
-rw-r--r--lib/Core/CoreStats.h3
-rw-r--r--lib/Core/Executor.cpp2
-rw-r--r--lib/Core/StatsTracker.cpp8
4 files changed, 12 insertions, 2 deletions
diff --git a/lib/Core/CoreStats.cpp b/lib/Core/CoreStats.cpp
index 2589d7da..720fa1b2 100644
--- a/lib/Core/CoreStats.cpp
+++ b/lib/Core/CoreStats.cpp
@@ -16,6 +16,7 @@ Statistic stats::coveredInstructions("CoveredInstructions", "Icov");
 Statistic stats::falseBranches("FalseBranches", "Bf");
 Statistic stats::forkTime("ForkTime", "Ftime");
 Statistic stats::forks("Forks", "Forks");
+Statistic stats::inhibitedForks("InhibitedForks", "InhibForks");
 Statistic stats::instructionRealTime("InstructionRealTimes", "Ireal");
 Statistic stats::instructionTime("InstructionTimes", "Itime");
 Statistic stats::instructions("Instructions", "I");
diff --git a/lib/Core/CoreStats.h b/lib/Core/CoreStats.h
index 354706f5..b624d1aa 100644
--- a/lib/Core/CoreStats.h
+++ b/lib/Core/CoreStats.h
@@ -30,6 +30,9 @@ namespace stats {
   /// The number of process forks.
   extern Statistic forks;
 
+  /// Number of inhibited forks.
+  extern Statistic inhibitedForks;
+
   /// Number of states, this is a "fake" statistic used by istats, it
   /// isn't normally up-to-date.
   extern Statistic states;
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 9322f50a..c3a10144 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -897,6 +897,7 @@ void Executor::branch(ExecutionState &state,
         result.push_back(nullptr);
       }
     }
+    stats::inhibitedForks += N - 1;
   } else {
     stats::forks += N-1;
 
@@ -1074,6 +1075,7 @@ Executor::StatePair Executor::fork(ExecutionState &current, ref<Expr> condition,
           addConstraint(current, Expr::createIsZero(condition));
           res = Solver::False;
         }
+        ++stats::inhibitedForks;
       }
     }
   }
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp
index 539b913c..18c0a691 100644
--- a/lib/Core/StatsTracker.cpp
+++ b/lib/Core/StatsTracker.cpp
@@ -451,6 +451,7 @@ void StatsTracker::writeStatsHeader() {
              << "ResolveTime INTEGER,"
              << "QueryCexCacheMisses INTEGER,"
              << "QueryCexCacheHits INTEGER,"
+             << "InhibitedForks INTEGER,"
              << "ArrayHashTime INTEGER"
          << ')';
   char *zErrMsg = nullptr;
@@ -484,6 +485,7 @@ void StatsTracker::writeStatsHeader() {
              << "ResolveTime,"
              << "QueryCexCacheMisses,"
              << "QueryCexCacheHits,"
+             << "InhibitedForks,"
              << "ArrayHashTime"
          << ") VALUES ("
              << "?,"
@@ -505,6 +507,7 @@ void StatsTracker::writeStatsHeader() {
              << "?,"
              << "?,"
              << "?,"
+             << "?,"
              << "? "
          << ')';
 
@@ -537,10 +540,11 @@ void StatsTracker::writeStatsLine() {
   sqlite3_bind_int64(insertStmt, 17, stats::resolveTime);
   sqlite3_bind_int64(insertStmt, 18, stats::queryCexCacheMisses);
   sqlite3_bind_int64(insertStmt, 19, stats::queryCexCacheHits);
+  sqlite3_bind_int64(insertStmt, 20, stats::inhibitedForks);
 #ifdef KLEE_ARRAY_DEBUG
-  sqlite3_bind_int64(insertStmt, 20, stats::arrayHashTime);
+  sqlite3_bind_int64(insertStmt, 21, stats::arrayHashTime);
 #else
-  sqlite3_bind_int64(insertStmt, 20, -1LL);
+  sqlite3_bind_int64(insertStmt, 21, -1LL);
 #endif
   int errCode = sqlite3_step(insertStmt);
   if(errCode != SQLITE_DONE) klee_error("Error writing stats data: %s", sqlite3_errmsg(statsFile));