diff options
| -rw-r--r-- | src/focaccia/benchmark/_benchmark.py | 2 | ||||
| -rwxr-xr-x | src/focaccia/tools/benchmark_focaccia.py | 28 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/focaccia/benchmark/_benchmark.py b/src/focaccia/benchmark/_benchmark.py index 60570f7..46e67d0 100644 --- a/src/focaccia/benchmark/_benchmark.py +++ b/src/focaccia/benchmark/_benchmark.py @@ -10,7 +10,6 @@ import subprocess import time def main(): - print("Benchmarking focaccia") args = make_argparser().parse_args() detlog = DeterministicLog(args.deterministic_log) @@ -30,6 +29,7 @@ def main(): time.sleep(0.5) timer.unpause() gdb_server = _qemu_tool.GDBServerStateIterator(f"localhost:{args.port}", detlog) + gdb.execute("si") gdb.execute("continue") qemu_process.wait() timer.pause() diff --git a/src/focaccia/tools/benchmark_focaccia.py b/src/focaccia/tools/benchmark_focaccia.py index 3b3019e..ad4ce02 100755 --- a/src/focaccia/tools/benchmark_focaccia.py +++ b/src/focaccia/tools/benchmark_focaccia.py @@ -58,6 +58,8 @@ def main(): argparser = make_argparser() args = argparser.parse_args() + logging.basicConfig(level=logging.ERROR) + # Test native tracing detlog = DeterministicLog(args.deterministic_log) if args.deterministic_log and detlog.base_directory is None: @@ -79,6 +81,32 @@ def main(): with open(f"/tmp/benchmark-{args.binary.split('/')[-1]}-symbolic.trace", 'w') as file: parser.serialize_transformations(trace, file) + # Emu exec plain + try: + timer = Timer("Emulator execution (plain)", iterations=args.iterations) + for i in range(timer.iterations): + qemu_process = subprocess.run( + [f"qemu-{args.guest_arch}", args.binary], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL + ) + timer.log_time() + except Exception as e: + raise Exception(f'Unable to benchmark QEMU: {e}') + + # Emu exec one instruction per block + try: + timer = Timer("Emulator execution (-one-insn-per-tb)", iterations=args.iterations) + for i in range(timer.iterations): + qemu_process = subprocess.run( + [f"qemu-{args.guest_arch}", "-one-insn-per-tb", args.binary], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL + ) + timer.log_time() + except Exception as e: + raise Exception(f'Unable to benchmark QEMU: {e}') + # Get environment env = os.environ.copy() # QEMU GDB interface |