""" Linux BenchTools - Benchmark Model """ from sqlalchemy import Column, Integer, Float, DateTime, String, Text, ForeignKey from sqlalchemy.orm import relationship from datetime import datetime from app.db.base import Base class Benchmark(Base): """ Benchmark run results """ __tablename__ = "benchmarks" id = Column(Integer, primary_key=True, index=True, autoincrement=True) device_id = Column(Integer, ForeignKey("devices.id"), nullable=False, index=True) hardware_snapshot_id = Column(Integer, ForeignKey("hardware_snapshots.id"), nullable=False) run_at = Column(DateTime, nullable=False, default=datetime.utcnow, index=True) bench_script_version = Column(String(50), nullable=False) # Scores global_score = Column(Float, nullable=False) cpu_score = Column(Float, nullable=True) memory_score = Column(Float, nullable=True) disk_score = Column(Float, nullable=True) network_score = Column(Float, nullable=True) gpu_score = Column(Float, nullable=True) # Details details_json = Column(Text, nullable=False) # JSON object with all raw results network_results_json = Column(Text, nullable=True) # Network benchmark details (iperf3) notes = Column(Text, nullable=True) # Relationships device = relationship("Device", back_populates="benchmarks") hardware_snapshot = relationship("HardwareSnapshot", back_populates="benchmarks") def __repr__(self): return f""