added dynamic discovery of configurations
This commit is contained in:
19
src/main.rs
19
src/main.rs
@@ -30,7 +30,8 @@ use mediator::{TelemetryState, UiCommand, BenchmarkPhase};
|
||||
use sal::traits::{AuditError, PlatformSal};
|
||||
use sal::mock::MockSal;
|
||||
use sal::heuristic::engine::HeuristicEngine;
|
||||
use load::{StressNg, Workload};
|
||||
use sal::heuristic::discovery::SystemFactSheet;
|
||||
use load::{StressNg};
|
||||
use orchestrator::BenchmarkOrchestrator;
|
||||
use ui::dashboard::{draw_dashboard, DashboardState};
|
||||
use engine::OptimizationResult;
|
||||
@@ -67,9 +68,10 @@ fn print_summary_report(result: &OptimizationResult) {
|
||||
println!("│ Burst (PL2): {:>5.1} W │", result.recommended_pl2);
|
||||
|
||||
println!("│ │");
|
||||
println!("│ {} │", "Apply to /etc/throttled.conf:".bold().magenta());
|
||||
println!("│ PL1_Tdp_W: {:<5.1} │", result.recommended_pl1);
|
||||
println!("│ PL2_Tdp_W: {:<5.1} │", result.recommended_pl2);
|
||||
println!("│ {} │", "Apply these to your system:".bold().magenta());
|
||||
for (id, path) in &result.config_paths {
|
||||
println!("│ {:<10}: {:<34} │", id, path.display());
|
||||
}
|
||||
println!("╰──────────────────────────────────────────────────╯");
|
||||
println!();
|
||||
}
|
||||
@@ -108,11 +110,12 @@ fn main() -> Result<()> {
|
||||
info!("ember-tune starting with args: {:?}", args);
|
||||
|
||||
// 2. Platform Detection & Audit
|
||||
let sal: Arc<dyn PlatformSal> = if args.mock {
|
||||
Arc::new(MockSal::new())
|
||||
let (sal_box, facts): (Box<dyn PlatformSal>, SystemFactSheet) = if args.mock {
|
||||
(Box::new(MockSal::new()), SystemFactSheet::default())
|
||||
} else {
|
||||
HeuristicEngine::detect_and_build()?.into()
|
||||
HeuristicEngine::detect_and_build()?
|
||||
};
|
||||
let sal: Arc<dyn PlatformSal> = sal_box.into();
|
||||
|
||||
println!("{}", console::style("─── Pre-flight System Audit ───").bold().cyan());
|
||||
let mut audit_failures = Vec::new();
|
||||
@@ -163,10 +166,12 @@ fn main() -> Result<()> {
|
||||
|
||||
// 5. Spawn Backend Orchestrator
|
||||
let sal_backend = sal.clone();
|
||||
let facts_backend = facts.clone();
|
||||
let backend_handle = thread::spawn(move || {
|
||||
let workload = Box::new(StressNg::new());
|
||||
let mut orchestrator = BenchmarkOrchestrator::new(
|
||||
sal_backend,
|
||||
facts_backend,
|
||||
workload,
|
||||
telemetry_tx,
|
||||
command_rx,
|
||||
|
||||
Reference in New Issue
Block a user