Crate sysinfo [−] [src]
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::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. |
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
DiskExt |
Contains all the methods of the |
ProcessExt |
Contains all the methods of the |
ProcessorExt |
Contains all the methods of the |
SystemExt |
Contains all the methods of the |