Get random sysinfo & print to terminal
This commit is contained in:
parent
73aeab77e1
commit
b92b5430e1
3 changed files with 20 additions and 1 deletions
|
@ -4,3 +4,4 @@ version = "0.1.0"
|
|||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
sysinfo = "0.30.12"
|
||||
|
|
BIN
src/main
BIN
src/main
Binary file not shown.
20
src/main.rs
20
src/main.rs
|
@ -1,3 +1,21 @@
|
|||
use sysinfo::System;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
get_sys_info()
|
||||
}
|
||||
|
||||
fn get_sys_info() {
|
||||
let mut sys = System::new_all();
|
||||
|
||||
// First we update all information of our `System` struct.
|
||||
sys.refresh_all();
|
||||
|
||||
// Display system information:
|
||||
println!("System name: {:?}", System::name());
|
||||
println!("Kernel version: {:?}", System::kernel_version());
|
||||
println!("System OS version: {:?}", System::os_version());
|
||||
println!("System host name: {:?}", System::host_name());
|
||||
|
||||
// Number of CPUs:
|
||||
println!("Number of CPUs: {}", sys.cpus().len());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue