quantrs2_tytan/advanced_performance_analysis/
config.rs1use super::*;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct AnalysisConfig {
8 pub real_time_monitoring: bool,
10 pub monitoring_frequency: f64,
12 pub collection_level: MetricsLevel,
14 pub analysis_depth: AnalysisDepth,
16 pub comparative_analysis: bool,
18 pub performance_prediction: bool,
20 pub statistical_analysis: StatisticalAnalysisConfig,
22 pub visualization: VisualizationConfig,
24}
25
26#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
28pub enum MetricsLevel {
29 Basic,
31 Detailed,
33 Comprehensive,
35 Custom { metrics: Vec<String> },
37}
38
39#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
41pub enum AnalysisDepth {
42 Surface,
44 Deep,
46 Exhaustive,
48 Adaptive,
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54pub struct StatisticalAnalysisConfig {
55 pub confidence_level: f64,
57 pub bootstrap_samples: usize,
59 pub hypothesis_testing: bool,
61 pub significance_level: f64,
63 pub outlier_detection: bool,
65 pub outlier_method: OutlierDetectionMethod,
67}
68
69#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
71pub enum OutlierDetectionMethod {
72 ZScore { threshold: f64 },
74 IQR { multiplier: f64 },
76 IsolationForest,
78 LocalOutlierFactor,
80 StatisticalTests,
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize)]
86pub struct VisualizationConfig {
87 pub real_time_plots: bool,
89 pub plot_update_frequency: f64,
91 pub export_formats: Vec<ExportFormat>,
93 pub dashboard: DashboardConfig,
95}
96
97#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
99pub enum ExportFormat {
100 CSV,
101 JSON,
102 PNG,
103 SVG,
104 PDF,
105 HTML,
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110pub struct DashboardConfig {
111 pub enable_web_dashboard: bool,
113 pub port: u16,
115 pub update_interval: f64,
117 pub enable_alerts: bool,
119 pub alert_thresholds: HashMap<String, f64>,
121}
122
123pub fn create_default_analysis_config() -> AnalysisConfig {
125 AnalysisConfig {
126 real_time_monitoring: true,
127 monitoring_frequency: 1.0, collection_level: MetricsLevel::Detailed,
129 analysis_depth: AnalysisDepth::Deep,
130 comparative_analysis: true,
131 performance_prediction: true,
132 statistical_analysis: StatisticalAnalysisConfig {
133 confidence_level: 0.95,
134 bootstrap_samples: 1000,
135 hypothesis_testing: true,
136 significance_level: 0.05,
137 outlier_detection: true,
138 outlier_method: OutlierDetectionMethod::IQR { multiplier: 1.5 },
139 },
140 visualization: VisualizationConfig {
141 real_time_plots: true,
142 plot_update_frequency: 0.5, export_formats: vec![ExportFormat::PNG, ExportFormat::CSV, ExportFormat::HTML],
144 dashboard: DashboardConfig {
145 enable_web_dashboard: true,
146 port: 8080,
147 update_interval: 2.0, enable_alerts: true,
149 alert_thresholds: {
150 let mut thresholds = HashMap::new();
151 thresholds.insert("cpu_utilization".to_string(), 80.0);
152 thresholds.insert("memory_utilization".to_string(), 85.0);
153 thresholds.insert("io_utilization".to_string(), 90.0);
154 thresholds
155 },
156 },
157 },
158 }
159}
160
161pub fn create_lightweight_config() -> AnalysisConfig {
163 let mut config = create_default_analysis_config();
164 config.collection_level = MetricsLevel::Basic;
165 config.analysis_depth = AnalysisDepth::Surface;
166 config.comparative_analysis = false;
167 config.performance_prediction = false;
168 config
169}