about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2022-01-06 14:34:32 +0000
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2022-01-07 12:46:01 +0000
commitb9308c3cc6eb8a8ff2177f7904d81919a8cc0828 (patch)
treea81316d9e2a538d0c29e4490618138b940ae521f
parent8e91181bce293e969de57d5cb1bc24eb5682a6f2 (diff)
downloadklee-b9308c3cc6eb8a8ff2177f7904d81919a8cc0828.tar.gz
klee-stats: fix BCov calculation for zero br instructions
-rwxr-xr-xtools/klee-stats/klee-stats9
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/klee-stats/klee-stats b/tools/klee-stats/klee-stats
index e355f452..a699fb3d 100755
--- a/tools/klee-stats/klee-stats
+++ b/tools/klee-stats/klee-stats
@@ -155,11 +155,6 @@ def select_columns(record, pr):
 
 
 def add_artificial_columns(record):
-    # special case for straight-line code: report 100% branch coverage
-    if "NumBranches" in record and record["NumBranches"] == 0:
-        record["FullBranches"] = 1
-        record["NumBranches"] = 1
-
     # Convert recorded times from microseconds to seconds
     for key in ["UserTime", "WallTime", "QueryTime", "SolverTime", "CexCacheTime", "ForkTime", "ResolveTime"]:
         if not key in record:
@@ -184,7 +179,9 @@ def add_artificial_columns(record):
 
     # Calculate branch coverage
     if "FullBranches" in record and "PartialBranches" in record and "NumBranches" in record:
-        record["BCov"] = 100 * ( 2 * record["FullBranches"] + record["PartialBranches"]) / ( 2 * record["NumBranches"])
+        record["BCov"] = 100.0
+        if record["NumBranches"] != 0:
+            record["BCov"] *= (2 * record["FullBranches"] + record["PartialBranches"]) / (2 * record["NumBranches"])
 
     # Add relative times
     for key in ["SolverTime", "CexCacheTime", "ForkTime", "ResolveTime", "UserTime"]: