Skip to content

Commit

Permalink
Merge pull request #119 from outbrain/log-detected-x86-features
Browse files Browse the repository at this point in the history
Log detected x86 features
  • Loading branch information
ggaspersic authored Apr 16, 2024
2 parents 9e9035b + b444353 commit 342e69d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/logging_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,31 @@ pub fn initialize_logging_layer() {
if builder.try_init().is_ok() {
log::info!("Initialized the logger ..")
}

log_detected_x86_features();
}

fn log_detected_x86_features() {
let mut features: Vec<String> = Vec::new();
if is_x86_feature_detected!("avx") {
features.push("AVX".to_string());
}

if is_x86_feature_detected!("avx2") {
features.push("AVX2".to_string());
}

if is_x86_feature_detected!("avx512f") {
features.push("AVX512F".to_string());
}

if is_x86_feature_detected!("fma") {
features.push("FMA".to_string());
}

if features.is_empty() {
log::info!("No selected CPU features detected ..");
} else {
log::info!("Detected CPU features: {:?}", features.join(", "));
}
}

0 comments on commit 342e69d

Please sign in to comment.