Skip to main content

Crate ltop

Crate ltop 

Source
Expand description

ltop: btop-styled TUI monitor (net / lan / disk io / conns / procs)

Modules§

app
collect
config
Persistent user config: ~/.config/ltop/config.conf, plain key = value. Loaded at startup; menu settings changes mutate the app and rewrite the file immediately (no hot file watching — restart-free by construction).
lansetup
ltop lan-setup:macOS 27 邻居/网卡 MAC 门控的零特权退避开关——安装 常驻用户 LaunchAgent,用 Apple 平台签名工具(/usr/sbin/arp、 /sbin/ifconfig)每 30s 轮转两份快照到 state 目录,LAN 盒 / NET 盒读 文件补真值。判别器实测与门控模型见 crate::collect::lan_snapshot。
log
Session monitoring log: periodic JSONL snapshots of per-process totals (network bytes + disk bytes) for post-hoc analysis of abnormal processes.
replay
Replay / analysis of session JSONL logs written by MonLog (~/.local/state/ltop/session-*.jsonl).
report
消费端摘要:ltop report <file> — 把 schema v1 JSONL(watch 产物 / TUI monlog v2)聚合为窗口摘要。
snapshot
AI-friendly structured snapshot (schema v1) — one serialization source shared by ltop --json, the monitoring log (v2 JSONL), ltop watch output and ltop report input.
theme
theme_data
ui
watch
headless 采集:ltop watch — 复用 TUI 采样层(App update / schema v1), JSONL 逐行追加(写到一半的行可跳过,崩溃安全)。输出与 TUI monlog (ltop-log-)分文件:默认 ltop-session-.jsonl,不会被 TUI 的保留期 清理(ltop-log-/session-* 前缀)碰到。

Functions§

arch_guard
eBPF 探针的 PT_REGS 寄存器映射与各数据源都按 x86_64 与 aarch64 双架构 覆盖;其他架构启动即明确报错,而不是静默产出错账
cli_lang_zh
CLI 消息语言:默认英文,config.conf 的 lang=zh 切中文(headless 路径 不建 App,轻量直读配置;cfg(test) 下按测试隔离约定返回默认 En)
cli_main
entry point used by the ltop binary (and any symlink alias to it)
dump
headless dump of one sampled round (debug aid)
json_snapshot
AI-friendly structured snapshot: two sampling rounds (rates), JSON out
pick
EN/ZH 字面量二选一(配合 cli_lang_zh 使用;返回 String 规避闭包寿命)
pick_s
print_schema
field reference for --json consumers (machine-parseable, versioned)