5 releases

0.1.4 Jul 23, 2024
0.1.3 Mar 6, 2023
0.1.2 Jan 29, 2022
0.1.1 Jan 28, 2022
0.1.0 Jan 26, 2022

#294 in Unix APIs

Download history 123/week @ 2024-07-22 54/week @ 2024-07-29 15/week @ 2024-09-16 6/week @ 2024-09-23 10/week @ 2024-09-30

194 downloads per month

MIT/Apache

7KB
126 lines

Rust Docs

rin

A small rust library to fetch system information on linux

Installation

Add rin-sys = "0.1.4" to your Cargo.toml

Usage


let ram_info = rin_sys::get_ram_info();
let cpu_info = rin_sys::get_cpu_info();

RAM info struct -

#[derive(Default, Debug)]
pub struct RamInfo {
   pub mem_used: usize,
   pub mem_free: usize,
   pub mem_total: usize,
   pub percent_free: f32,
   pub percent_used: f32,
}

CPU info struct -

#[derive(Debug, Default)]
pub struct CpuInfo {
   pub cache_size: String,
   pub cores: usize,
   pub cpu_speed: Vec<(usize, f64)>,
   pub model_name: String,
   pub vendor_id: String,
   pub is_fpu: bool,
   pub cpuid_level: f32,
}

No runtime deps