Skip to main content

handle_events

Function handle_events 

Source
pub fn handle_events(
    tree: &impl TreeStore,
    cache: &impl CacheStore,
    events: &[ProcEvent],
)
Expand description

Handle a batch of process lifecycle events.

use proc_tree::{DefaultTree, DefaultCache, handle_events, ProcEvent, CacheStore, TreeStore};

let tree = DefaultTree::new(100, 0);
let cache = DefaultCache::new(100, 0);

handle_events(&tree, &cache, &[
    ProcEvent::Fork { child_pid: 200, parent_pid: 100, timestamp_ns: 0 },
]);

let node = tree.get_node(200).unwrap();
assert_eq!(node.ppid, 100);