58 releases

0.5.7 Aug 10, 2018
0.5.6 May 22, 2018
0.5.5 Apr 24, 2018
0.5.3 Mar 22, 2018
0.0.2 Jul 25, 2015

#23 in Filesystem

Download history 104/week @ 2018-09-10 270/week @ 2018-09-17 420/week @ 2018-09-24 646/week @ 2018-10-01 343/week @ 2018-10-08 239/week @ 2018-10-15 1148/week @ 2018-10-22 298/week @ 2018-10-29 531/week @ 2018-11-05 430/week @ 2018-11-12 335/week @ 2018-11-19 324/week @ 2018-11-26 413/week @ 2018-12-03

810 downloads per month
Used in 6 crates

LGPL-3.0+

197KB
4.5K SLoC

sysinfo Build status

A system handler to interact with processes.

Support the following platforms:

  • Linux
  • Raspberry
  • Mac OSX
  • Windows

Running on Raspberry

It'll be difficult to build on Raspberry. A good way-around is to be build on Linux before sending it to your Raspberry:

rustup target add armv7-unknown-linux-gnueabihf
cargo build --target=armv7-unknown-linux-gnueabihf

Code example

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:

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.get_network().get_income());
println!("output data: {} B", sys.get_network().get_outcome());

// Components temperature:
for component in sys.get_components_list() {
    println!("{:?}", component);
}

// Memory information:
println!("total memory: {} kB", sys.get_total_memory());
println!("used memory : {} kB", sys.get_used_memory());
println!("total swap  : {} kB", sys.get_total_swap());
println!("used swap   : {} kB", sys.get_used_swap());

// Number of processes
println!("NB processes: {}", sys.get_processor_list().len());

// To refresh all system information:
sys.refresh_all();

C interface

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:

> make
> ./simple
# If needed:
> LD_LIBRARY_PATH=target/release/ ./simple

Dependencies

~1.5MB
~27K SLoC

  • windows winapi 0.3+fileapi+handleapi+ioapiset+minwindef+pdh+psapi+synchapi+sysinfoapi+tlhelp32+winbase+winerror+winioctl+winnt
  • cfg-if 0.1
  • libc 0.2
  • rayon 1.0
  • build build.rs