#[cfg(feature = "nostd")]
use alloc::{string::String, vec::Vec};
#[cfg(not(feature = "nostd"))]
use std::{string::String, vec::Vec};
#[derive(Debug, Clone)]
pub struct BenchmarkConfig {
pub iterations: usize,
pub warmup_iterations: usize,
pub measure_memory: bool,
pub measure_frame_rate: bool,
pub test_resolutions: Vec<(u32, u32)>,
pub animation_duration_cs: u32,
}
impl Default for BenchmarkConfig {
fn default() -> Self {
Self {
iterations: 10,
warmup_iterations: 3,
measure_memory: true,
measure_frame_rate: true,
test_resolutions: vec![
(1280, 720), (1920, 1080), (3840, 2160), ],
animation_duration_cs: 1000, }
}
}
#[derive(Debug, Clone)]
pub struct BenchmarkResult {
pub test_name: String,
pub resolution: (u32, u32),
pub our_performance: PerformanceMetrics,
pub performance_ratio: Option<f64>,
pub memory_ratio: Option<f64>,
pub compatibility_score: f64,
}
#[derive(Debug, Clone)]
pub struct PerformanceMetrics {
pub avg_render_time_ms: f64,
pub min_render_time_ms: f64,
pub max_render_time_ms: f64,
pub render_time_std_dev: f64,
pub fps: Option<f64>,
pub peak_memory_bytes: Option<usize>,
pub avg_memory_bytes: Option<usize>,
pub cache_hit_rate: Option<f64>,
}
#[derive(Debug, Clone)]
pub struct PerformanceReport {
pub results: Vec<BenchmarkResult>,
pub summary: PerformanceSummary,
}
#[derive(Debug, Clone)]
pub struct PerformanceSummary {
pub total_tests: usize,
pub avg_performance_ratio: f64,
pub avg_compatibility_score: f64,
pub avg_fps: f64,
pub fastest_test: Option<String>,
pub slowest_test: Option<String>,
}
impl Default for PerformanceSummary {
fn default() -> Self {
Self {
total_tests: 0,
avg_performance_ratio: 1.0,
avg_compatibility_score: 1.0,
avg_fps: 0.0,
fastest_test: None,
slowest_test: None,
}
}
}