added skip system info flag, and ran clippy
This commit is contained in:
@@ -125,7 +125,7 @@ pub fn calculate_primes(range_start: u64, range_end: u64) -> u64 {
|
||||
current_number = 3;
|
||||
}
|
||||
|
||||
if current_number % 2 == 0 {
|
||||
if current_number.is_multiple_of(2) {
|
||||
current_number += 1;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ pub fn is_number_prime(number: u64) -> bool {
|
||||
let search_limit = (number as f64).sqrt() as u64;
|
||||
|
||||
for i in (3..=search_limit).step_by(2) {
|
||||
if number % i == 0 {
|
||||
if number.is_multiple_of(i) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ pub mod benchmark;
|
||||
pub mod slimes;
|
||||
|
||||
pub fn application_header() -> &'static str {
|
||||
let ascii_art = r#"
|
||||
r#"
|
||||
.---.
|
||||
.' '. < CPU SLIME >
|
||||
/ ^ ^ \
|
||||
@@ -12,7 +12,7 @@ pub fn application_header() -> &'static str {
|
||||
| |
|
||||
\ /
|
||||
'._____.'
|
||||
"#;
|
||||
// println!("{}", ascii_art.bright_green().bold());
|
||||
ascii_art
|
||||
"#
|
||||
// .bright_green()
|
||||
// .bold()
|
||||
}
|
||||
|
||||
18
src/main.rs
18
src/main.rs
@@ -15,6 +15,10 @@ pub struct Cli {
|
||||
#[arg(short, long)]
|
||||
pub skip_benchmark: bool,
|
||||
|
||||
/// Skil system info
|
||||
#[arg(short = 'S', long)]
|
||||
pub skip_system_info: bool,
|
||||
|
||||
/// Benchmark: Upper limit for prime calculation (higher number = longer test)
|
||||
#[arg(short, long, default_value_t = 500_000)]
|
||||
pub prime_limit: u64,
|
||||
@@ -34,15 +38,17 @@ fn main() {
|
||||
|
||||
println!("{}", application_header().bright_blue());
|
||||
|
||||
let slimes = get_all_slimes();
|
||||
if !cli.skip_system_info {
|
||||
let slimes = get_all_slimes();
|
||||
|
||||
let mut sys = System::new_all();
|
||||
sys.refresh_all();
|
||||
let mut sys = System::new_all();
|
||||
sys.refresh_all();
|
||||
|
||||
for slime in slimes {
|
||||
slime.print(&sys);
|
||||
for slime in slimes {
|
||||
slime.print(&sys);
|
||||
}
|
||||
println!();
|
||||
}
|
||||
println!();
|
||||
|
||||
if !cli.skip_benchmark {
|
||||
let logical_core_count = match cli.jobs {
|
||||
|
||||
@@ -17,7 +17,7 @@ pub trait Slime {
|
||||
format!("{}:", self.label()).bold().color(self.color())
|
||||
);
|
||||
} else {
|
||||
print!("{} {:<10} ", " ", " ");
|
||||
print!(" {:<10} ", " ");
|
||||
}
|
||||
println!("{}", val.white());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user