| 1 |
use anyhow::Result; |
| 2 |
|
| 3 |
mod kitty_image_flood; |
| 4 |
mod pty_to_pixel; |
| 5 |
mod vtebench; |
| 6 |
|
| 7 |
pub(crate) struct WorkloadResult { |
| 8 |
pub name: String, |
| 9 |
|
| 10 |
pub metrics: Vec<(String, f64)>, |
| 11 |
} |
| 12 |
|
| 13 |
pub(crate) trait Workload: Send + Sync { |
| 14 |
fn name(&self) -> &'static str; |
| 15 |
fn description(&self) -> &'static str; |
| 16 |
fn run(&self) -> Result<WorkloadResult>; |
| 17 |
} |
| 18 |
|
| 19 |
pub(crate) struct Registry(Vec<Box<dyn Workload>>); |
| 20 |
|
| 21 |
impl Registry { |
| 22 |
pub(crate) fn default_set() -> Self { |
| 23 |
Self(vec![ |
| 24 |
Box::new(vtebench::Cat), |
| 25 |
Box::new(vtebench::Scrolling), |
| 26 |
Box::new(vtebench::Unicode), |
| 27 |
Box::new(kitty_image_flood::KittyImageFlood), |
| 28 |
Box::new(pty_to_pixel::PtyToPixel), |
| 29 |
]) |
| 30 |
} |
| 31 |
|
| 32 |
pub(crate) fn iter(&self) -> impl Iterator<Item = &dyn Workload> { |
| 33 |
self.0.iter().map(AsRef::as_ref) |
| 34 |
} |
| 35 |
} |
| 36 |
|