sysinfo
A system handler to interact with processes.
Support the following platforms:
- Linux
- Raspberry
- Android
- Mac OSX
- Windows
It also compiles for Android but never been tested on it.
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:
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:
use ;
let mut sys = new;
// We display the disks:
println!;
for disk in sys.get_disks
// Network data:
println!;
println!;
// Components temperature:
for component in sys.get_components_list
// Memory information:
println!;
println!;
println!;
println!;
// Number of processors
println!;
// 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/
Benchmarks
You can run the benchmarks locally with rust nightly by doing:
> cargo
Here are the current results:
Linux
test bench_new ... bench: 10,437,759 ns/iter (+/- 531,424)
test bench_refresh_all ... bench: 2,658,946 ns/iter (+/- 189,612)
test bench_refresh_cpu ... bench: 13,429 ns/iter (+/- 537)
test bench_refresh_disk_lists ... bench: 50,688 ns/iter (+/- 8,032)
test bench_refresh_disks ... bench: 2,582 ns/iter (+/- 226)
test bench_refresh_memory ... bench: 12,015 ns/iter (+/- 537)
test bench_refresh_network ... bench: 23,661 ns/iter (+/- 617)
test bench_refresh_process ... bench: 56,157 ns/iter (+/- 2,445)
test bench_refresh_processes ... bench: 2,486,534 ns/iter (+/- 121,187)
test bench_refresh_system ... bench: 53,739 ns/iter (+/- 6,793)
test bench_refresh_temperatures ... bench: 25,770 ns/iter (+/- 1,164)
Windows
test bench_new ... bench: 61,548,071 ns/iter (+/- 196,093,742)
test bench_refresh_all ... bench: 2,541,951 ns/iter (+/- 482,285)
test bench_refresh_cpu ... bench: 460 ns/iter (+/- 478)
test bench_refresh_disk_lists ... bench: 152,940 ns/iter (+/- 8,330)
test bench_refresh_disks ... bench: 55,597 ns/iter (+/- 9,629)
test bench_refresh_memory ... bench: 2,130 ns/iter (+/- 486)
test bench_refresh_network ... bench: 212 ns/iter (+/- 216)
test bench_refresh_process ... bench: 38 ns/iter (+/- 33)
test bench_refresh_processes ... bench: 2,175,034 ns/iter (+/- 315,585)
test bench_refresh_system ... bench: 2,508 ns/iter (+/- 224)
test bench_refresh_temperatures ... bench: 1 ns/iter (+/- 0)
OSX
test bench_new ... bench: 4,713,851 ns/iter (+/- 1,080,986)
test bench_refresh_all ... bench: 1,639,098 ns/iter (+/- 191,147)
test bench_refresh_cpu ... bench: 10,651 ns/iter (+/- 1,635)
test bench_refresh_disk_lists ... bench: 29,327 ns/iter (+/- 3,104)
test bench_refresh_disks ... bench: 942 ns/iter (+/- 79)
test bench_refresh_memory ... bench: 3,417 ns/iter (+/- 654)
test bench_refresh_network ... bench: 34,497 ns/iter (+/- 2,681)
test bench_refresh_process ... bench: 4,272 ns/iter (+/- 549)
test bench_refresh_processes ... bench: 782,977 ns/iter (+/- 30,958)
test bench_refresh_system ... bench: 336,008 ns/iter (+/- 43,015)
test bench_refresh_temperatures ... bench: 294,323 ns/iter (+/- 41,612)
Donations
If you appreciate my work and want to support me, you can do it here: