Skip to main content

gglib_core/domain/benchmark/
summary.rs

1//! Denormalised per-model benchmark summary.
2
3use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6/// Denormalised benchmark summary for a single model.
7///
8/// Upserted in the same transaction as each new result so that the model list
9/// query can LEFT JOIN this table and show speed badges without extra round-trips.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct ModelBenchmarkSummary {
12    /// Foreign key → `models.id`.
13    pub model_id: i64,
14    /// Best token-generation throughput across all perf runs.
15    pub best_tg_tps: Option<f64>,
16    /// Best prompt-processing throughput across all perf runs.
17    pub best_pp_tps: Option<f64>,
18    /// Token-generation throughput from the most recent perf run.
19    pub latest_tg_tps: Option<f64>,
20    /// Prompt-processing throughput from the most recent perf run.
21    pub latest_pp_tps: Option<f64>,
22    /// Backend reported by the most recent perf run.
23    pub latest_backend: Option<String>,
24    /// Total number of perf runs recorded for this model.
25    pub perf_run_count: i64,
26    /// Total number of compare runs recorded for this model.
27    pub compare_run_count: i64,
28    /// UTC timestamp of the most recent benchmark (either type).
29    pub last_benchmarked_at: DateTime<Utc>,
30    /// UTC timestamp of the last summary update.
31    pub updated_at: DateTime<Utc>,
32}