Crates.io | machine-info |
lib.rs | machine-info |
version | 1.0.9 |
source | src |
created_at | 2022-09-02 20:24:56.757579 |
updated_at | 2022-10-04 14:12:32.683512 |
description | CPU, GPU and memory monitor. Use it to track resources usage |
homepage | https://wixet.com |
repository | https://github.com/wixet-limited/machine-info-rs |
max_upload_size | |
id | 657572 |
size | 36,942 |
Get information about your machine and monitor the resources usage.
There are many crates to get information about your system. We actually are using some of them but this crate adds a feature to constantly monitor the system without a big overhead.
You can probe your system for CPU or memory usage once per second and your machine performance will not be affected at all. Other crates consumed like 7-10% of CPU which is not acceptable. But to be fair, these other crates are doing many other things apart from getting the cpu/memory usage.
This crate focus only on this, nothing else. Limited but lightweight. If you want a full featured crate better use other one.
Just a simple monitoring
[dependencies]
machine-info = "1.0.6"
Put this in your main.rs:
use machine_info::Machine;
use std::{thread, time};
fn main() {
let mut m = Machine::new();
// Please use a real PIDs!
m.track_process(132801).unwrap();
m.track_process(32930).unwrap();
for _ in 1..100 {
let processes = m.processes_status();
let system = m.system_status();
let graphics = m.graphics_status();
println!("{:?} {:?} {:?}", processes, system, graphics);
thread::sleep(time::Duration::from_millis(1000));
}
}
You can compile the library with v4l
support for cameras scanning.
[dependencies]
machine-info = { version = "1.0.6", features = ["v4l"] }
Your probably need to install libclang-dev package
sudo apt-get install libclang-dev
This crate is based on other awesome libraries like:
sysinfo
: sysinfo is a crate used to get a system’s information.
nvml-wrapper
: A safe and ergonomic Rust wrapper for the NVIDIA Management Library (NVML)
libv4l-rs
: Safe video4linux (v4l) bindings
This project is licensed under the Apache 2 license.