about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/focaccia/benchmark/_benchmark.py14
-rwxr-xr-xsrc/focaccia/tools/benchmark_focaccia.py25
2 files changed, 30 insertions, 9 deletions
diff --git a/src/focaccia/benchmark/_benchmark.py b/src/focaccia/benchmark/_benchmark.py
index 46e67d0..c6059cd 100644
--- a/src/focaccia/benchmark/_benchmark.py
+++ b/src/focaccia/benchmark/_benchmark.py
@@ -9,9 +9,7 @@ import gdb
 import subprocess
 import time
 
-def main():
-    args = make_argparser().parse_args()
-
+def runtime():
     detlog = DeterministicLog(args.deterministic_log)
     if args.deterministic_log and detlog.base_directory is None:
         raise NotImplementedError(f'Deterministic log {args.deterministic_log} specified but '
@@ -31,6 +29,10 @@ def main():
             gdb_server = _qemu_tool.GDBServerStateIterator(f"localhost:{args.port}", detlog)
             gdb.execute("si")
             gdb.execute("continue")
+            try:
+                gdb.execute("continue")
+            except:
+                pass
             qemu_process.wait()
             timer.pause()
         timer.log_time()
@@ -98,5 +100,11 @@ def main():
     except Exception as e:
         raise Exception('Error occured when comparing with symbolic equations: {e}')
 
+def main():
+    args = make_argparser().parse_args()
+
+    if args.runtime:
+        runtime()
+
 if __name__ == "__main__":
     main()
diff --git a/src/focaccia/tools/benchmark_focaccia.py b/src/focaccia/tools/benchmark_focaccia.py
index ad4ce02..6b184b5 100755
--- a/src/focaccia/tools/benchmark_focaccia.py
+++ b/src/focaccia/tools/benchmark_focaccia.py
@@ -34,6 +34,12 @@ def make_argparser():
     prog.add_argument('-n', '--iterations',
                       default='10',
                       help='Number of iterations per benchmark')
+    prog.add_argument('--runtime',
+                      action='store_true',
+                      help='Split runtime breakdown benchmarks')
+    prog.add_argument('--tracing',
+                      action='store_true',
+                      help='Tracing benchmarks')
     prog.add_argument('-l', '--deterministic-log',
                       help='Path of the directory storing the deterministic log produced by RR')
     prog.add_argument('--gdb',
@@ -54,12 +60,7 @@ def try_remove(l: list, v):
     except ValueError:
         pass
 
-def main():
-    argparser = make_argparser()
-    args = argparser.parse_args()
-
-    logging.basicConfig(level=logging.ERROR)
-
+def runtime_benchmark():
     # Test native tracing
     detlog = DeterministicLog(args.deterministic_log)
     if args.deterministic_log and detlog.base_directory is None:
@@ -107,6 +108,18 @@ def main():
     except Exception as e:
         raise Exception(f'Unable to benchmark QEMU: {e}')
 
+def tracing_benchmarks():
+    pass
+
+def main():
+    argparser = make_argparser()
+    args = argparser.parse_args()
+
+    logging.basicConfig(level=logging.ERROR)
+
+    if args.runtime:
+        runtime_benchmark()
+
     # Get environment
     env = os.environ.copy()
     # QEMU GDB interface