Dirk end to end analysis
[Benchmarks_CSolver.git] / dirk-new / endtoendeval / satunetimecomputer.py
diff --git a/dirk-new/endtoendeval/satunetimecomputer.py b/dirk-new/endtoendeval/satunetimecomputer.py
new file mode 100644 (file)
index 0000000..3089e59
--- /dev/null
@@ -0,0 +1,45 @@
+import os
+import sys
+import random
+import re
+
+import os
+
+
+myfile = ''
+
+def validateArgs():
+        global myfile;
+        if len(sys.argv) != 2:
+                print("Wrong argument! Usage: python satunetimecomputer.py satune_trace.log");
+                sys.exit(-1);
+        else:
+                myfile = sys.argv[1];
+
+
+def analyzeExecution():
+       solving=0;
+       total=0;
+       print(myfile);
+       with open(myfile, "r") as f:
+               line = f.readline()
+               while line:
+                       if 'SAT Solving time' in line:
+                               time =re.findall("\d+\.\d+", line)
+                               solving = solving + float(time[0]);
+                       elif 'CSOLVER solve time' in line:
+                               time =re.findall("\d+\.\d+", line);
+                               total = total + float(time[0]);
+
+                       line = f.readline()
+
+       print("Total SAT Solving Time: " + str(solving));
+       print("Total SATTune Time: " + str(total));
+
+def main():
+       validateArgs();
+       analyzeExecution();
+
+if __name__ == "__main__":
+    main();
+