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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! # ktop
//!
//! `ktop` is a Linux process monitor and process-action tool. It ships as a
//! binary that can run either as a full terminal UI or as a non-interactive CLI
//! helper for grep, anomaly inspection, and targeted process signals.
//!
//! ## Install
//!
//! ```bash
//! cargo install ktop
//! ```
//!
//! ## TUI Mode
//!
//! ```bash
//! ktop
//! ```
//!
//! The TUI uses the built-in Scrin renderer and Aisling effects layer. Scrin
//! keeps a frame diff and reuses frame buffers, while Aisling provides sparse
//! color/effect pulses that avoid repainting the whole terminal.
//!
//! Useful keys:
//!
//! - `/` opens spotlight grep.
//! - `T` toggles process tree mode.
//! - `A` toggles anomaly mode.
//! - `s` opens the signal palette.
//! - `K` confirms `SIGTERM` for the selected process.
//! - `e` toggles visual effects.
//!
//! Mouse support is enabled in the TUI:
//!
//! - Hover over a row for quick actions.
//! - Left click selects a process.
//! - Right click opens the signal palette.
//! - Middle click opens confirmed `SIGTERM`.
//!
//! ## CLI Fast Paths
//!
//! These commands do not initialize the TUI, which makes them useful on loaded
//! systems, degraded terminals, and scripts:
//!
//! ```bash
//! ktop --grep 'cmd:python user:root'
//! ktop --anomalies --limit 20
//! ktop --kill 'cmd:firefox' --signal TERM
//! ktop --kill 1234 --signal KILL --yes
//! ktop --version
//! ktop --diagnostics
//! ktop --stability-check --samples 120 --interval-ms 500
//! ```
//!
//! `--kill` accepts either a PID/comma-separated PID list or a spotlight query.
//! It asks for confirmation unless `--yes` is provided and sends signals
//! directly with `libc::kill`.
//!
//! ## Resource Bounds
//!
//! Long-running TUI state is bounded: histories use capped ring buffers,
//! Scrin frame buffers are capped, spotlight input and parsed query tokens have
//! explicit limits, process and CPU samples have hard caps, command-line reads
//! from `/proc` have byte caps, and cached process metadata is evicted when a
//! PID/start-time pair is no longer present in the current `/proc` snapshot.
//! `ktop --diagnostics` prints the live process/sample counts and configured
//! resource caps plus cap-hit state, while `ktop --stability-check` reports RSS,
//! cap-hit state, and cache high-water marks across repeated bounded samples.
//!
//! ## Spotlight Query Language
//!
//! Plain tokens match PID, user, process name, and command line. Field tokens
//! include `user:root`, `name:ssh`, `cmd:python`, `pid:123`, `ppid:1`,
//! `uid:1000`, `state:R`, `cpu>20`, `mem<10`, `age>2h`, and `!token` negation.
//!
//! ## Platform
//!
//! `ktop` currently targets Linux and reads process data from `/proc`.
//!
//! ## Library API
//!
//! This crate is published primarily as a binary application. The library target
//! exists to provide docs.rs documentation for the installed command.
/// The package version published to crates.io.
pub const VERSION: &str = env!;