Output clean-up and add CPU model fetching/total system memory
This commit is contained in:
parent
f2ceea0cc1
commit
674fc191b7
1 changed files with 14 additions and 6 deletions
20
src/main.rs
20
src/main.rs
|
@ -5,6 +5,8 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_sys_info() {
|
fn get_sys_info() {
|
||||||
|
let bytes_per_gib: u64 = 2u64.pow(30);
|
||||||
|
|
||||||
// Please note that we use "new_all" to ensure that all list of
|
// Please note that we use "new_all" to ensure that all list of
|
||||||
// components, network interfaces, disks and users are already
|
// components, network interfaces, disks and users are already
|
||||||
// filled!
|
// filled!
|
||||||
|
@ -14,11 +16,17 @@ fn get_sys_info() {
|
||||||
sys.refresh_all();
|
sys.refresh_all();
|
||||||
|
|
||||||
// Print system information:
|
// Print system information:
|
||||||
println!("System name: {:?}", System::name());
|
println!("System Name: {}", System::name().unwrap());
|
||||||
println!("Kernel version: {:?}", System::kernel_version());
|
println!("Kernel Version: {}", System::kernel_version().unwrap());
|
||||||
println!("System OS version: {:?}", System::os_version());
|
println!("System OS Version: {}", System::os_version().unwrap());
|
||||||
println!("System host name: {:?}", System::host_name());
|
println!("System Hostname: {}", System::host_name().unwrap());
|
||||||
|
|
||||||
// Print number of CPUs:
|
// Print CPU information:
|
||||||
println!("Number of CPUs: {}", sys.cpus().len());
|
println!("CPU Model: {}", sys.cpus()[0].brand());
|
||||||
|
println!("CPU Architecture: {}", System::cpu_arch().unwrap());
|
||||||
|
println!("Number of Cores: {}", sys.physical_core_count().unwrap());
|
||||||
|
println!("Number of Cores + Threads: {}", sys.cpus().len());
|
||||||
|
|
||||||
|
// Print memory information:
|
||||||
|
println!("Total Memory: {:.2} GB", sys.total_memory() as f64 / bytes_per_gib as f64);
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue