chore: initialize autoresearch baseline

This commit is contained in:
Evandro Fonseca Junior committed 2026-03-26 17:28:25 -03:00
commit f83e8b83f6
42 files changed
+10550

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
use std::time::Instant;
/// Records a single generation run and computes TPS.
#[derive(Debug)]
pub struct GenerationRecord {
pub start: Instant,
pub prompt_tokens: u32,
pub completion_tokens: u32,
}
impl GenerationRecord {
pub fn new(prompt_tokens: u32) -> Self {
Self {
start: Instant::now(),
prompt_tokens,
completion_tokens: 0,
}
}
pub fn tick(&mut self) {
self.completion_tokens += 1;
}
pub fn elapsed_secs(&self) -> f64 {
self.start.elapsed().as_secs_f64()
}
pub fn tokens_per_second(&self) -> f64 {
if self.completion_tokens == 0 {
return 0.0;
}
self.completion_tokens as f64 / self.elapsed_secs()
}
}