Crate proc_status[][src]

basic process information

The data comes from /proc/<pid>/process and is only available on unix-like systems.

This crate aims at keeping very simple. If it doesn’t cover your needs, you should probably have a look at the much more complete procfs.

Examples:

Dump memory info about the current process:

let mem = proc_status::mem_usage().unwrap();
println!("Mem usage in bytes: current={}, peak={}", mem.current, mem.peak);

This prints something like

Mem usage in bytes: current=1232896, peak=141430784
use proc_status::ProcStatus;

let ps = ProcStatus::read().unwrap();
for entry in ps.entries() {
    let entry = entry.unwrap();
    println!("{} = {:?}", entry.key, entry.value);
}

Get the raw value of specific entries

use proc_status::ProcStatus;

let ps = ProcStatus::read().unwrap();
println!("State: {:?}", ps.value("State").unwrap());
println!("VmPeak in bytes: {:?}", ps.value_KiB("VmPeak").unwrap() * 1024);

Structs

MemUsage

information about the physical RAM usage of a process

ProcEntries

an iterator over the entries of a procstatus.

ProcEntry

a key:value line in the proc/status pseudo-file

ProcStatus

A snapshot of the status of a process

Enums

ProcRef

the reference to a process, either the symbolic “self” or a process id

ProcStatusError

any error which can be raised in this crate

Functions

mem_usage

load information about the current en peak memory usage of the current process

value

get the value of an entry by name

value_KiB

get the value of an entry by name if it is a size in KiB.