Skip to main content

snapshot

Function snapshot 

Source
pub fn snapshot(tree: &impl TreeStore, cache: &impl CacheStore)
Expand description

Snapshot all running processes from /proc.

Populates both the tree and cache. Call once at startup before processing events.

use proc_tree::{DefaultTree, DefaultCache, snapshot, TreeStore};

let tree = DefaultTree::new(65536, 600);
let cache = DefaultCache::new(65536, 600);
snapshot(&tree, &cache);

// PID 1 should always exist on Linux
assert!(tree.get_node(1).is_some());