use crate::{
app::App,
model::cpu::{CoreKind, DetectionSource},
};
pub fn core_type_status(app: &App) -> String {
let known = app
.cpu
.cores
.iter()
.flat_map(|core| core.logical_cpus.iter())
.filter_map(|id| {
app.cpu
.cpus
.iter()
.find(|cpu| cpu.logical_id == *id)
.map(|cpu| cpu.core_kind)
})
.any(|kind| {
matches!(
kind,
CoreKind::Performance | CoreKind::Efficiency | CoreKind::LowPowerEfficiency
)
});
if !known {
return "Core type unknown".into();
}
if app
.cpu
.cpus
.iter()
.any(|cpu| cpu.detection.source != DetectionSource::KernelMetadata)
{
"P/E labels estimated ⚠".into()
} else {
"P/E labels detected".into()
}
}