mirror of
https://github.com/nicolargo/glances.git
synced 2026-06-03 03:15:09 -04:00
Sister of the v5 ``mem`` plugin. Same pattern, slimmer layout (single-column body — v4 ``memswap.msg_curse`` does not 2-col). Model (``glances/plugins/memswap/model_v5.py``): - ``total`` / ``used`` / ``free`` — bytes, snapshot. - ``percent`` — watched + prominent, default thresholds 50/70/90 (same ladder as ``mem`` for UX consistency). - ``sin`` / ``sout`` — cumulative in v4; v5 exposes them as bytes/sec via ``rate: True``. - Tolerates platforms without a swap file (Illumos, OpenBSD — issues #1767, #2719): psutil raises, model returns ``{}`` so the scheduler tick keeps going. Renderer (``glances/plugins/memswap/render_curses_v5.py``): SWAP 25.0% total 16.0G used 4.0G free 12.0G - Line 1: ``SWAP`` (HEADER) + percent cell coloured by ``_levels.percent``. Title escalates to warning/critical when the prominent percent reaches those levels. - Lines 2-4: ``total`` / ``used`` / ``free`` as label/value pairs. - Value column floored at 6 chars so it does not jiggle between cycles. Adjacent changes: - ``KNOWN_V5_MISSING_PLUGINS`` in ``mcp_adapter_v5`` shrinks to ``processlist, fs, diskio`` — memswap no longer surfaces in the MCP startup gap log. - v4 catalogue (``docs/architecture/tui-v4-rendering-patterns.md``) grows a ``## memswap`` section + ✅ footer pointing to the new renderer. 22 new tests (11 model + 11 renderer). Full v5 suite: 669 passed (+22), lint clean.