Crate sys_metrics

source ·
Expand description

sys_metrics is a crate used to get a system’s information.

It provide information about:

  • CPU
  • Disks
  • Host
  • Memory
  • Network
  • Virtualization

§Quick start

use sys_metrics::{cpu::*};

// This is just a very basic example of the CPU part.
// Check the doc, this crate can do much more.
let cpufreq = get_cpufreq().unwrap();
println!("CPU Speed: {:13}MHz\n", cpufreq as u64);

let cpu_logical = get_logical_count().unwrap();
let cpu_physical = get_physical_count().unwrap();

println!("CPU Core: {:12}\nLogical processors: {}", cpu_physical, cpu_logical);

let loadavg = get_loadavg().unwrap();
println!("Load average: {:10} {} {}", loadavg.one, loadavg.five, loadavg.fifteen);

Modules§

  • CPU information
  • Disks information
  • Host system information
  • Memory information
  • Network information
  • Virtualization information

Functions§

  • Function used if you want to divide ticked value by the host’s jiffies (USER_HZ) value. (like CpuStats)