A system handler to interact with processes.
Support the following platforms:
It'll be difficult to build on Raspberry. A good way-around is to be build on Linux before sending it to your Raspberry:
bash
rustup target add armv7-unknown-linux-gnueabihf
cargo build --target=armv7-unknown-linux-gnueabihf
You have an example into the examples
folder. Just run cargo run
inside the examples
folder to start it. Otherwise, here is a little code sample:
```rust extern crate sysinfo;
use sysinfo::{NetworkExt, System, SystemExt};
let mut sys = System::new();
// We display the disks: println!("=> disk list:"); for disk in sys.get_disks() { println!("{:?}", disk); }
// Network data: println!("input data : {} B", sys.getnetwork().getincome()); println!("output data: {} B", sys.getnetwork().getoutcome());
// Components temperature: for component in sys.getcomponentslist() { println!("{:?}", component); }
// Memory information: println!("total memory: {} kB", sys.gettotalmemory()); println!("used memory : {} kB", sys.getusedmemory()); println!("total swap : {} kB", sys.gettotalswap()); println!("used swap : {} kB", sys.getusedswap());
// Number of processes println!("NB processes: {}", sys.getprocessorlist().len());
// To refresh all system information: sys.refresh_all(); ```
It's possible to use this crate directly from C. Take a look at the Makefile
and at the examples/src/simple.c
file.
To build the C example, just run:
```bash
make ./simple
If needed:
LDLIBRARYPATH=target/release/ ./simple ```