[][src]Crate sysinfo

sysinfo is a crate used to get a system's information.

Before any attempt to read the different structs' information, you need to update them to get up-to-date information.

Examples

use sysinfo::{ProcessExt, SystemExt};

let mut system = sysinfo::System::new();

// First we update all information of our system struct.
system.refresh_all();

// Now let's print every process' id and name:
for (pid, proc_) in system.get_process_list() {
    println!("{}:{} => status: {:?}", pid, proc_.name(), proc_.status());
}

// Then let's print the temperature of the different components:
for component in system.get_components_list() {
    println!("{:?}", component);
}

// And then all disks' information:
for disk in system.get_disks() {
    println!("{:?}", disk);
}

// And finally the RAM and SWAP information:
println!("total memory: {} kB", system.get_total_memory());
println!("used memory : {} kB", system.get_used_memory());
println!("total swap  : {} kB", system.get_total_swap());
println!("used swap   : {} kB", system.get_used_swap());

Structs

Component

More information can be found at http://lxr.free-electrons.com/source/Documentation/hwmon/sysfs-interface

Disk

Struct containing a disk information.

NetworkData

Contains network information.

Process

Struct containing a process' information.

Processor

Struct containing a processor information.

System

Structs containing system's information.

Enums

DiskType

Enum containing the different handled disks types.

ProcessStatus

Enum describing the different status of a process.

Signal

An enum representing signal on UNIX-like systems.

Traits

AsU32

Trait to have a common fallback for the Pid type.

ComponentExt

Getting a component temperature information.

DiskExt

Contains all the methods of the Disk struct.

NetworkExt

Getting volume of incoming and outgoing data.

ProcessExt

Contains all the methods of the Process struct.

ProcessorExt

Contains all the methods of the Processor struct.

SystemExt

Contains all the methods of the System struct.

Functions

get_current_pid

Returns the pid for the current process.

Type Definitions

Pid

Process id.