//! CPU profiling module

pub mod cache;
pub mod profiler;
pub mod rhai;
pub mod scaling;
pub mod single;
pub mod throttle;
pub mod topology;
pub mod usage;
pub mod workloads;

#[cfg(test)]
mod tests;

#[cfg(test)]
mod thermal_tests;

pub use cache::{CacheMissResult, measure_cache_misses};
pub use profiler::{CPUProfiler, run_cpu_benchmark};
pub use scaling::{ScalingResult, measure_multi_thread_scaling};
pub use single::{SingleThreadResult, measure_single_thread_performance};
pub use throttle::{
    ThermalPlatform, ThermalSeverity, ThermalState, detect_thermal_state,
    is_thermal_detection_supported, is_thermal_throttling,
};
pub use topology::detect_cpu_topology;
pub use usage::{CPUUsageProfile, profile_cpu_usage};
pub use workloads::{InstructionResult, test_instruction_throughput};

/// CPU benchmark result
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct CPUBenchmarkResult {
    pub single_thread: SingleThreadResult,
    pub multi_thread: Option<MultiThreadResult>,
    pub scaling: Option<ScalingResult>,
    pub cache_misses: Option<CacheMissResult>,
}

/// Multi-thread result
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct MultiThreadResult {
    pub threads: u32,
    pub total_score: f64,
    pub per_thread_score: f64,
    pub duration: std::time::Duration,
}
