import platform
import shutil
import subprocess
from pathlib import Path
FRAMEWORK_DIR = Path(__file__).parent
IMPLEMENTATIONS_DIR = FRAMEWORK_DIR / "implementations"
RESULTS_DIR = FRAMEWORK_DIR / "results"
FIGURES_DIR = Path(__file__).parent.parent.parent / "docs" / "figures"
RUST_BINARY = IMPLEMENTATIONS_DIR / "rust" / "target" / "release" / "bench_comparative"
JAVA_PROJECT_DIR = IMPLEMENTATIONS_DIR / "java"
DEFAULT_ITERATIONS = 100
DEFAULT_SEED = 42
def collect_system_info() -> dict:
info = {
"platform": platform.platform(),
"processor": platform.processor(),
"cpu_count": platform.os.cpu_count(),
"python_version": platform.python_version(),
"machine": platform.machine(),
}
if shutil.which("rustc"):
try:
result = subprocess.run(
["rustc", "--version"], capture_output=True, text=True, timeout=5
)
info["rust_version"] = result.stdout.strip()
except (subprocess.TimeoutExpired, FileNotFoundError):
info["rust_version"] = "unknown"
if shutil.which("java"):
try:
result = subprocess.run(
["java", "--version"], capture_output=True, text=True, timeout=5
)
info["java_version"] = result.stdout.strip().split("\n")[0]
except (subprocess.TimeoutExpired, FileNotFoundError):
info["java_version"] = "unknown"
try:
import brahe
info["brahe_version"] = getattr(brahe, "__version__", "unknown")
except ImportError:
info["brahe_version"] = "not installed"
return info