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