ass_renderer/debug/benchmarking/
types.rs1#[cfg(feature = "nostd")]
4use alloc::{string::String, vec::Vec};
5#[cfg(not(feature = "nostd"))]
6use std::{string::String, vec::Vec};
7
8#[derive(Debug, Clone)]
10pub struct BenchmarkConfig {
11 pub iterations: usize,
13 pub warmup_iterations: usize,
15 pub measure_memory: bool,
17 pub measure_frame_rate: bool,
19 pub test_resolutions: Vec<(u32, u32)>,
21 pub animation_duration_cs: u32,
23}
24
25impl Default for BenchmarkConfig {
26 fn default() -> Self {
27 Self {
28 iterations: 10,
29 warmup_iterations: 3,
30 measure_memory: true,
31 measure_frame_rate: true,
32 test_resolutions: vec![
33 (1280, 720), (1920, 1080), (3840, 2160), ],
37 animation_duration_cs: 1000, }
39 }
40}
41
42#[derive(Debug, Clone)]
44pub struct BenchmarkResult {
45 pub test_name: String,
47 pub resolution: (u32, u32),
49 pub our_performance: PerformanceMetrics,
51 pub performance_ratio: Option<f64>,
53 pub memory_ratio: Option<f64>,
55 pub compatibility_score: f64,
57}
58
59#[derive(Debug, Clone)]
61pub struct PerformanceMetrics {
62 pub avg_render_time_ms: f64,
64 pub min_render_time_ms: f64,
66 pub max_render_time_ms: f64,
68 pub render_time_std_dev: f64,
70 pub fps: Option<f64>,
72 pub peak_memory_bytes: Option<usize>,
74 pub avg_memory_bytes: Option<usize>,
76 pub cache_hit_rate: Option<f64>,
78}
79
80#[derive(Debug, Clone)]
82pub struct PerformanceReport {
83 pub results: Vec<BenchmarkResult>,
85 pub summary: PerformanceSummary,
87}
88
89#[derive(Debug, Clone)]
91pub struct PerformanceSummary {
92 pub total_tests: usize,
94 pub avg_performance_ratio: f64,
96 pub avg_compatibility_score: f64,
98 pub avg_fps: f64,
100 pub fastest_test: Option<String>,
102 pub slowest_test: Option<String>,
104}
105
106impl Default for PerformanceSummary {
107 fn default() -> Self {
108 Self {
109 total_tests: 0,
110 avg_performance_ratio: 1.0,
111 avg_compatibility_score: 1.0,
112 avg_fps: 0.0,
113 fastest_test: None,
114 slowest_test: None,
115 }
116 }
117}