Initial commit: 2125_GCE project
This commit is contained in:
Executable
+88
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Direct Glyphrunner Benchmark - Simplified, No Threading
|
||||
|
||||
Runs XIC symbolic execution directly without threading complexity.
|
||||
Shows true Glyphrunner throughput on a single machine.
|
||||
"""
|
||||
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
|
||||
# Add parent directory to path for imports
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
os.chdir(Path(__file__).parent.parent)
|
||||
|
||||
PROGRAMS_DIR = Path.cwd() / "programs"
|
||||
|
||||
|
||||
def main():
|
||||
"""Run direct Glyphrunner benchmark."""
|
||||
duration = int(sys.argv[1]) if len(sys.argv) > 1 else 60
|
||||
|
||||
# Use an existing demo program that works
|
||||
test_program = str(PROGRAMS_DIR / "demo_control_flow_if.gx.json")
|
||||
|
||||
print("\n" + "="*70)
|
||||
print("GLYPHRUNNER BENCHMARK: Direct XIC Execution")
|
||||
print("="*70)
|
||||
print(f"Start Time: {datetime.now().isoformat()}")
|
||||
print(f"Duration: {duration} seconds")
|
||||
print(f"Test Program: {test_program}")
|
||||
print()
|
||||
|
||||
from xic_executor import run_xic
|
||||
|
||||
execution_count = 0
|
||||
success_count = 0
|
||||
failed_count = 0
|
||||
start_time = time.time()
|
||||
last_report = start_time
|
||||
|
||||
print("Starting execution...")
|
||||
print()
|
||||
|
||||
while time.time() - start_time < duration:
|
||||
try:
|
||||
ctx = run_xic(test_program, debug=False)
|
||||
execution_count += 1
|
||||
success_count += 1
|
||||
except Exception as e:
|
||||
execution_count += 1
|
||||
failed_count += 1
|
||||
|
||||
# Report progress every 5 seconds
|
||||
now = time.time()
|
||||
if now - last_report > 5:
|
||||
elapsed = now - start_time
|
||||
rate = execution_count / elapsed if elapsed > 0 else 0
|
||||
print(f"⚡ {execution_count} executions | {rate:.1f} exec/sec | {success_count} success | {failed_count} failed")
|
||||
last_report = now
|
||||
|
||||
total_elapsed = time.time() - start_time
|
||||
|
||||
# Final report
|
||||
print()
|
||||
print("="*70)
|
||||
print("GLYPHRUNNER BENCHMARK RESULTS (Direct Execution)")
|
||||
print("="*70)
|
||||
print()
|
||||
print(f"Duration: {total_elapsed:.1f} seconds")
|
||||
print(f"Total Executions: {execution_count}")
|
||||
print(f"Successful: {success_count}")
|
||||
print(f"Failed: {failed_count}")
|
||||
success_rate = 100 * success_count / max(1, execution_count)
|
||||
print(f"Success Rate: {success_rate:.1f}%")
|
||||
print()
|
||||
throughput = execution_count / total_elapsed if total_elapsed > 0 else 0
|
||||
print(f"Throughput: {throughput:.1f} executions/second")
|
||||
print()
|
||||
print("="*70)
|
||||
print(f"End Time: {datetime.now().isoformat()}")
|
||||
print("="*70)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user