gglib_core/domain/benchmark/
perf.rs1use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct PerfConfig {
9 pub model_ids: Vec<i64>,
11 #[serde(default = "PerfConfig::default_pp_tokens")]
13 pub pp_tokens: u32,
14 #[serde(default = "PerfConfig::default_tg_tokens")]
16 pub tg_tokens: u32,
17 #[serde(default = "PerfConfig::default_repetitions")]
19 pub repetitions: u32,
20}
21
22impl PerfConfig {
23 const fn default_pp_tokens() -> u32 {
24 512
25 }
26 const fn default_tg_tokens() -> u32 {
27 128
28 }
29 const fn default_repetitions() -> u32 {
30 3
31 }
32}
33
34impl Default for PerfConfig {
35 fn default() -> Self {
36 Self {
37 model_ids: vec![],
38 pp_tokens: Self::default_pp_tokens(),
39 tg_tokens: Self::default_tg_tokens(),
40 repetitions: Self::default_repetitions(),
41 }
42 }
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47pub struct ModelPerfResult {
48 pub id: Option<i64>,
50 pub model_id: i64,
52 pub run_id: Option<i64>,
54 pub pp_tps: f64,
56 pub tg_tps: f64,
58 pub pp_tokens: i64,
60 pub tg_tokens: i64,
62 pub backend: Option<String>,
64 pub ngl: Option<i64>,
66 pub context_size: Option<i64>,
68 pub repetitions: i64,
70 pub created_at: DateTime<Utc>,
72}