Skip to content

Commit

Permalink
feat: Warn when CPU with AVX/AVX2 support is used
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernauer committed Jun 16, 2023
1 parent e08d515 commit caa118b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use breakwater::{
};
use clap::Parser;
use env_logger::Env;
use log::warn;
use std::sync::Arc;
use tokio::sync::{broadcast, mpsc};
#[cfg(feature = "vnc")]
Expand All @@ -21,6 +22,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
let args = Args::parse();

#[cfg(target_arch = "x86_64")]
{
if !is_x86_feature_detected!("avx2") {
warn!("Your CPU does not support AVX2. Consider using a CPU supporting AVX2 for best performance");
} else if !is_x86_feature_detected!("avx") {
warn!("Your CPU does not support AVX. Consider using a CPU supporting AVX2 (or at least AVX) for best performance");
}
}

let fb = Arc::new(FrameBuffer::new(args.width, args.height));

// If we make the channel to big, stats will start to lag behind
Expand Down

0 comments on commit caa118b

Please sign in to comment.