1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! A process and system monitoring library for Rust, heavily inspired by the [`psutil`](https://psutil.readthedocs.io/en/latest/#) module for Python.
//!
//! # Minimum versions supported
//!
//! - Linux: 2.6.0 (2003-12-17)
//!
//! # Note about the API
//!
//! `rust-psutil` implements the same API as `psutil` with some exceptions:
//!
//! - some things have been slightly renamed
//! - the crate is namespaced based on subsystem, e.g. `cpu::cpu_percent()`
//!     - users can opt into which subsystems to use based on cargo feature flags
//! - some functions have been refactored
//!     - e.g. `cpu_count(bool)` into `cpu_count()` and `cpu_count_physical()`
//! - functions that need to persist data between calls are implemented as methods on 'collectors'
//!     - e.g. `cpu_percent()` -> `CpuPercentCollector::cpu_percent()`
//! - platform specific functionality is hidden behind traits that need to be imported before used
//!     - e.g. import `cpu::os::linux::ProcessExt` to use Linux specific process functionality
//! - some types are different, for example:
//!     - structs instead of named tuples
//!     - `std::time::Duration` instead of float for seconds
//!     - enums instead of constants
//! - most struct fields have been replaced with getter methods to better enable platform based extensions

#[macro_use]
mod utils;
pub mod common;
mod errors;
mod types;

pub use errors::*;
pub use types::*;

#[cfg(feature = "cpu")]
pub mod cpu;

#[cfg(feature = "disk")]
pub mod disk;

#[cfg(feature = "host")]
pub mod host;

#[cfg(feature = "memory")]
pub mod memory;

#[cfg(feature = "network")]
pub mod network;

#[cfg(feature = "process")]
pub mod process;

#[cfg(feature = "sensors")]
pub mod sensors;

cfg_if::cfg_if! {
	if #[cfg(target_family = "unix")] {
		mod unix;
		use unix::*;
	}
}