use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use super::external_integration::ExternalReporting;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BenchmarkSuiteConfig {
pub implementations: Vec<ImplementationConfig>,
pub test_categories: Vec<TestCategory>,
pub statistical_config: StatisticalConfig,
pub output_config: OutputConfig,
pub resource_config: ResourceConfig,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ImplementationConfig {
pub name: String,
pub id: String,
pub runtime: RuntimeConfig,
pub version: String,
pub expected_baseline: Option<f64>,
pub limitations: Vec<String>,
pub r7rs_compliant: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum RuntimeConfig {
Docker {
image: String,
container_args: Vec<String>,
volume_mounts: Vec<String>,
},
Native {
binary_path: String,
args: Vec<String>,
env_vars: HashMap<String, String>,
},
Lambdust {
target_dir: String,
profile: String, features: Vec<String>,
},
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TestCategory {
pub name: String,
pub description: String,
pub tests: Vec<TestCase>,
pub weight: f64,
pub critical: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TestCase {
pub name: String,
pub description: String,
pub code_template: String,
pub parameters: Vec<TestParameter>,
pub expected_result_type: ResultType,
pub resource_limits: TestResourceLimits,
pub performance_hints: PerformanceHints,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TestParameter {
pub name: String,
pub values: Vec<ParameterValue>,
pub scaling_behavior: ScalingBehavior,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum ParameterValue {
Integer {
value: i64
},
Float {
value: f64
},
String {
value: String
},
Boolean {
value: bool
},
Range {
start: i64,
end: i64,
step: i64
},
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ScalingBehavior {
Constant, Linear, Logarithmic, Quadratic, Exponential, Custom(String), }
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ResultType {
Number,
String,
Boolean,
List,
Any,
Error, }
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TestResourceLimits {
pub max_time_seconds: u64,
pub max_memory_mb: u64,
pub max_cpu_percent: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PerformanceHints {
pub fast_path_candidates: Vec<String>,
pub memory_patterns: Vec<String>,
pub complexity: ScalingBehavior,
pub critical_operations: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StatisticalConfig {
pub iterations: u32,
pub warmup_iterations: u32,
pub confidence_level: f64,
pub min_detectable_difference: f64,
pub outlier_detection: OutlierDetection,
pub normality_tests: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum OutlierDetection {
None,
IQR {
multiplier: f64
},
ZScore {
threshold: f64
},
ModifiedZScore {
threshold: f64
},
Grubbs {
alpha: f64
},
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OutputConfig {
pub output_dir: String,
pub formats: Vec<OutputFormat>,
pub generate_charts: bool,
pub chart_types: Vec<ChartType>,
pub external_reporting: Option<ExternalReporting>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum OutputFormat {
JSON,
CSV,
HTML,
Markdown,
LaTeX,
XML,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ChartType {
BarChart,
BoxPlot,
ScatterPlot,
PerformanceProfile,
MemoryUsageOverTime,
ScalingAnalysis,
ImplementationComparison,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ResourceConfig {
pub monitor_cpu: bool,
pub monitor_memory: bool,
pub monitor_disk_io: bool,
pub monitor_network_io: bool,
pub sampling_interval_ms: u64,
pub limits: SystemResourceLimits,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SystemResourceLimits {
pub max_total_memory_mb: u64,
pub max_cpu_percent: f64,
pub max_disk_usage_mb: u64,
pub global_timeout_seconds: u64,
}