Skip to main content

Module process

Module process 

Source
Expand description

Process list logic: ordering, filtering, and tree construction.

This module is the list half of the process view. The row data itself lives in crate::model::ProcessSnapshot; nothing here mutates a snapshot, because §10.4 requires published snapshots to stay immutable. Every entry point therefore returns indices into the slice it was given, in display order.

§What §7.2 demands of this module

  • Stable sorting with a PID/start-time tie-breaker. Every comparison ends in a crate::model::ProcessIdentity comparison, so rows with equal keys keep the same relative order on every refresh and selection does not jump.
  • Unavailable is not zero (§26). A metric that was never measured sorts to the end of the list in both directions instead of pretending to be 0.
  • Plain text filtering over name, command, PID, and user, with the user-only and hide-kernel-threads toggles expressed as separate composable predicates.
  • Tree mode that preserves parent-child relationships, keeps children under their parents when sorted, and survives a malformed parent graph.

§Rendering a tree row

ProcessTree emits a flat pre-order list of TreeRows carrying a depth, a last-sibling flag, and (via ProcessTree::continuation_flags) whether an ancestor still has siblings below it. That is everything a renderer needs for the strict-ASCII shape §5.1 requires:

systemd
+- sshd
|  `- bash
`- cron

§Example

use monitrs_core::process::{ProcessFilter, ProcessSort, flat_order};

let filter = ProcessFilter::parse("rustc");
flat_order(processes, &filter, ProcessSort::default())

Structs§

Coverage
How much of a sum’s membership actually contributed to it.
PlainPattern
A literal, case-insensitive substring pattern.
ProcessFilter
The complete set of active row filters for the process view (§7.2).
ProcessSort
A complete process table ordering: which column, and which way round.
ProcessTree
A process tree flattened into display order.
SubtreeUsage
What a process and its descendants are using, together.
Summed
One summed metric and the coverage of the sum.
TreeRow
One row of a rendered process tree.
UnknownSortKey
The error returned when a sort field name is not one this build knows.

Enums§

FilterPattern
How a filter query is interpreted.
ProcessPredicate
One independently toggleable row test (§7.2).
ProcessSortKey
A sortable column of the process table (§7.2).
SortDirection
Which end of the ordering comes first.

Functions§

flat_order
The visible rows of the flat process view, in display order.