pmemstat 4.1.0__tar.gz → 4.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pmemstat might be problematic. Click here for more details.
- {pmemstat-4.1.0 → pmemstat-4.2.0}/PKG-INFO +36 -17
- {pmemstat-4.1.0 → pmemstat-4.2.0}/README.md +25 -13
- {pmemstat-4.1.0 → pmemstat-4.2.0}/pmemstat/CGroup.py +0 -1
- {pmemstat-4.1.0 → pmemstat-4.2.0}/pmemstat/CpuSmooth.py +4 -4
- {pmemstat-4.1.0 → pmemstat-4.2.0}/pmemstat/History.py +2 -3
- {pmemstat-4.1.0 → pmemstat-4.2.0}/pmemstat/KillThem.py +3 -3
- {pmemstat-4.1.0 → pmemstat-4.2.0}/pmemstat/Pressure.py +0 -1
- {pmemstat-4.1.0 → pmemstat-4.2.0}/pmemstat/UiPrefs.py +16 -8
- pmemstat-4.2.0/pmemstat/__init__.py +6 -0
- {pmemstat-4.1.0 → pmemstat-4.2.0}/pmemstat/main.py +226 -262
- pmemstat-4.2.0/pyproject.toml +97 -0
- pmemstat-4.1.0/.github/workflows/ci.yml +0 -61
- pmemstat-4.1.0/.gitignore +0 -9
- pmemstat-4.1.0/images/pmemstat.2026-10-29.14-43.gif +0 -0
- pmemstat-4.1.0/images/pmemstat.png +0 -0
- pmemstat-4.1.0/images/scroll-pos.png +0 -0
- pmemstat-4.1.0/memtest.c +0 -415
- pmemstat-4.1.0/pmemstat/__init__.py +0 -0
- pmemstat-4.1.0/pylintrc +0 -24
- pmemstat-4.1.0/pyproject.toml +0 -47
- pmemstat-4.1.0/runner +0 -127
- pmemstat-4.1.0/tests/__init__.py +0 -65
- pmemstat-4.1.0/tests/fixtures/smaps_rollup_sample.txt +0 -23
- pmemstat-4.1.0/tests/fixtures/smaps_sample.txt +0 -1150
- pmemstat-4.1.0/tests/test_cgroup.py +0 -192
- pmemstat-4.1.0/tests/test_cpusmooth.py +0 -62
- pmemstat-4.1.0/tests/test_history.py +0 -303
- pmemstat-4.1.0/tests/test_main.py +0 -1858
- pmemstat-4.1.0/tests/test_pressure.py +0 -126
- pmemstat-4.1.0/tests/test_uiprefs.py +0 -156
- {pmemstat-4.1.0 → pmemstat-4.2.0}/LICENSE.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: pmemstat
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.0
|
|
4
4
|
Summary: Report Proportional Memory on Linux
|
|
5
5
|
Keywords: proportional memory,RAM,htop,top,monitor
|
|
6
6
|
Author-email: Joe Defen <joedef@duck.com>
|
|
@@ -17,12 +17,19 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
17
17
|
Classifier: License :: OSI Approved :: MIT License
|
|
18
18
|
Classifier: Operating System :: POSIX :: Linux
|
|
19
19
|
License-File: LICENSE.txt
|
|
20
|
-
Requires-Dist: console-window
|
|
20
|
+
Requires-Dist: console-window ~= 3.1.0
|
|
21
21
|
Requires-Dist: pylint == 3.3.4 ; extra == "dev"
|
|
22
|
-
Requires-Dist:
|
|
22
|
+
Requires-Dist: ruff >= 0.9 ; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest >= 7.0 ; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-cov >= 4.0 ; extra == "dev"
|
|
25
|
+
Requires-Dist: build >= 1.2 ; extra == "dev"
|
|
26
|
+
Requires-Dist: twine >= 7 ; extra == "dev"
|
|
27
|
+
Requires-Dist: packaging >= 26 ; extra == "dev"
|
|
28
|
+
Requires-Dist: tomli >= 2.0 ; extra == "dev" and ( python_version < "3.11")
|
|
23
29
|
Project-URL: Bug Tracker, https://github.com/joedefen/pmemstat/issues
|
|
24
30
|
Project-URL: Homepage, https://github.com/joedefen/pmemstat
|
|
25
31
|
Provides-Extra: dev
|
|
32
|
+
Import-Name: pmemstat
|
|
26
33
|
|
|
27
34
|
> **Quick Start**: from the CLI (requires **Python 3.10 or later**)
|
|
28
35
|
> * **Install (preferred, per-user):** `pipx install pmemstat`
|
|
@@ -85,7 +92,8 @@ See the **Quick Start** above for the basic install; **Alternative Installation
|
|
|
85
92
|
|
|
86
93
|
## Usage
|
|
87
94
|
```
|
|
88
|
-
usage: pmemstat [-h] [-D] [-C] [-a CPU_AVG_SECS] [-P]
|
|
95
|
+
usage: pmemstat [-h] [-D] [-C] [-a CPU_AVG_SECS] [-P] [--theme NAME]
|
|
96
|
+
[--list-themes]
|
|
89
97
|
[-g {exe,cmd,pid,cgroup,cgroupCharge}] [-f] [-k MIN_DELTA_KB]
|
|
90
98
|
[-l LOOP_SECS] [-L CMDLEN] [-t TOP_PCT] [-U]
|
|
91
99
|
[--save-history-now] [--reset-history-now] [-o]
|
|
@@ -106,6 +114,10 @@ options:
|
|
|
106
114
|
dflt=20]
|
|
107
115
|
-P, --psi show PSI (system pressure in header + memPSI% column)
|
|
108
116
|
[dflt=off]
|
|
117
|
+
--theme NAME initial colour theme (see --list-themes); "mono"
|
|
118
|
+
disables colour (it is also the last entry in the T
|
|
119
|
+
picker).
|
|
120
|
+
--list-themes list the available themes and exit
|
|
109
121
|
-g, --groupby {exe,cmd,pid,cgroup,cgroupCharge}
|
|
110
122
|
grouping method for presenting rows; the cgroup
|
|
111
123
|
variants differ only in the memory view: "cgroup"
|
|
@@ -246,12 +258,13 @@ In window mode colour highlights titles and values that are changing; it is
|
|
|
246
258
|
decoration only, so a terminal without colour (or `TERM=dumb`) still shows the
|
|
247
259
|
full report in plain text.
|
|
248
260
|
|
|
249
|
-
`t` opens
|
|
250
|
-
turns colour off
|
|
261
|
+
`t` opens console-window's theme picker (`ESC` returns) and `t` there cycles the
|
|
262
|
+
appearance: the palettes, then `mono`, which turns colour off and wraps back to
|
|
263
|
+
the first palette. A pick is applied immediately and remembered per user.
|
|
251
264
|
|
|
252
|
-
|
|
253
|
-
the standard `NO_COLOR` convention
|
|
254
|
-
|
|
265
|
+
`--theme` selects a theme and `--list-themes` prints the available names.
|
|
266
|
+
`--theme mono`, or the standard `NO_COLOR` convention, turns colour off; `mono`
|
|
267
|
+
is the last entry in the `t` picker cycle, and there is no separate colour flag.
|
|
255
268
|
|
|
256
269
|
## Memory growth (leak) detection
|
|
257
270
|
|
|
@@ -318,13 +331,19 @@ is showing, since resetting the baseline has no visible effect otherwise.
|
|
|
318
331
|
|
|
319
332
|
## Help Screen (in Window Mode, Press '?')
|
|
320
333
|
In window mode, `?` opens the help screen (and closes it again); **ESC** also
|
|
321
|
-
closes it.
|
|
322
|
-
with their possible values (the current choice
|
|
323
|
-
key (e.g. `c`) advances to the next value,
|
|
324
|
-
keys also work directly on the main screen
|
|
325
|
-
|
|
326
|
-
toggles **demo mode**, which shows the
|
|
327
|
-
**ENTER** closes nothing here — it
|
|
334
|
+
closes it. The navigation legend is at the top and, below the line, the option
|
|
335
|
+
keys for the screen you came from with their possible values (the current choice
|
|
336
|
+
is highlighted). Typing an option key (e.g. `c`) advances to the next value,
|
|
337
|
+
applied on the next loop; the option keys also work directly on the main screen
|
|
338
|
+
without opening the help screen. `t` opens the theme picker (where `t` cycles
|
|
339
|
+
the appearance), and `K` on this screen toggles **demo mode**, which shows the
|
|
340
|
+
last key pressed — handy for screencasts. **ENTER** closes nothing here — it
|
|
341
|
+
stays reserved for kill mode's row selection.
|
|
342
|
+
|
|
343
|
+
The first help page of a run also carries a **Fonts** section: the named
|
|
344
|
+
one-cell symbols and the emoji are drawn as fixed-width blocks, so a terminal
|
|
345
|
+
missing a glyph or shifting a wide character shows up as a visibly broken row
|
|
346
|
+
rather than a silently misaligned report.
|
|
328
347
|
|
|
329
348
|
## Inline Search (Window Mode)
|
|
330
349
|
Press `/` to activate inline search mode; the live search field is the trailing
|
|
@@ -59,7 +59,8 @@ See the **Quick Start** above for the basic install; **Alternative Installation
|
|
|
59
59
|
|
|
60
60
|
## Usage
|
|
61
61
|
```
|
|
62
|
-
usage: pmemstat [-h] [-D] [-C] [-a CPU_AVG_SECS] [-P]
|
|
62
|
+
usage: pmemstat [-h] [-D] [-C] [-a CPU_AVG_SECS] [-P] [--theme NAME]
|
|
63
|
+
[--list-themes]
|
|
63
64
|
[-g {exe,cmd,pid,cgroup,cgroupCharge}] [-f] [-k MIN_DELTA_KB]
|
|
64
65
|
[-l LOOP_SECS] [-L CMDLEN] [-t TOP_PCT] [-U]
|
|
65
66
|
[--save-history-now] [--reset-history-now] [-o]
|
|
@@ -80,6 +81,10 @@ options:
|
|
|
80
81
|
dflt=20]
|
|
81
82
|
-P, --psi show PSI (system pressure in header + memPSI% column)
|
|
82
83
|
[dflt=off]
|
|
84
|
+
--theme NAME initial colour theme (see --list-themes); "mono"
|
|
85
|
+
disables colour (it is also the last entry in the T
|
|
86
|
+
picker).
|
|
87
|
+
--list-themes list the available themes and exit
|
|
83
88
|
-g, --groupby {exe,cmd,pid,cgroup,cgroupCharge}
|
|
84
89
|
grouping method for presenting rows; the cgroup
|
|
85
90
|
variants differ only in the memory view: "cgroup"
|
|
@@ -220,12 +225,13 @@ In window mode colour highlights titles and values that are changing; it is
|
|
|
220
225
|
decoration only, so a terminal without colour (or `TERM=dumb`) still shows the
|
|
221
226
|
full report in plain text.
|
|
222
227
|
|
|
223
|
-
`t` opens
|
|
224
|
-
turns colour off
|
|
228
|
+
`t` opens console-window's theme picker (`ESC` returns) and `t` there cycles the
|
|
229
|
+
appearance: the palettes, then `mono`, which turns colour off and wraps back to
|
|
230
|
+
the first palette. A pick is applied immediately and remembered per user.
|
|
225
231
|
|
|
226
|
-
|
|
227
|
-
the standard `NO_COLOR` convention
|
|
228
|
-
|
|
232
|
+
`--theme` selects a theme and `--list-themes` prints the available names.
|
|
233
|
+
`--theme mono`, or the standard `NO_COLOR` convention, turns colour off; `mono`
|
|
234
|
+
is the last entry in the `t` picker cycle, and there is no separate colour flag.
|
|
229
235
|
|
|
230
236
|
## Memory growth (leak) detection
|
|
231
237
|
|
|
@@ -292,13 +298,19 @@ is showing, since resetting the baseline has no visible effect otherwise.
|
|
|
292
298
|
|
|
293
299
|
## Help Screen (in Window Mode, Press '?')
|
|
294
300
|
In window mode, `?` opens the help screen (and closes it again); **ESC** also
|
|
295
|
-
closes it.
|
|
296
|
-
with their possible values (the current choice
|
|
297
|
-
key (e.g. `c`) advances to the next value,
|
|
298
|
-
keys also work directly on the main screen
|
|
299
|
-
|
|
300
|
-
toggles **demo mode**, which shows the
|
|
301
|
-
**ENTER** closes nothing here — it
|
|
301
|
+
closes it. The navigation legend is at the top and, below the line, the option
|
|
302
|
+
keys for the screen you came from with their possible values (the current choice
|
|
303
|
+
is highlighted). Typing an option key (e.g. `c`) advances to the next value,
|
|
304
|
+
applied on the next loop; the option keys also work directly on the main screen
|
|
305
|
+
without opening the help screen. `t` opens the theme picker (where `t` cycles
|
|
306
|
+
the appearance), and `K` on this screen toggles **demo mode**, which shows the
|
|
307
|
+
last key pressed — handy for screencasts. **ENTER** closes nothing here — it
|
|
308
|
+
stays reserved for kill mode's row selection.
|
|
309
|
+
|
|
310
|
+
The first help page of a run also carries a **Fonts** section: the named
|
|
311
|
+
one-cell symbols and the emoji are drawn as fixed-width blocks, so a terminal
|
|
312
|
+
missing a glyph or shifting a wide character shows up as a visibly broken row
|
|
313
|
+
rather than a silently misaligned report.
|
|
302
314
|
|
|
303
315
|
## Inline Search (Window Mode)
|
|
304
316
|
Press `/` to activate inline search mode; the live search field is the trailing
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
"""
|
|
4
3
|
Class for fetching CPU usage from processes.
|
|
5
4
|
"""
|
|
6
5
|
# pylint: disable=invalid-name,broad-exception-caught,too-many-instance-attributes
|
|
7
6
|
# pylint: disable=import-outside-toplevel,too-many-branches,too-many-locals
|
|
8
7
|
# pylint: disable=consider-using-with,too-many-statements
|
|
8
|
+
import math
|
|
9
9
|
import os
|
|
10
|
-
import time
|
|
11
10
|
import re
|
|
11
|
+
import time
|
|
12
12
|
import traceback
|
|
13
|
-
import math
|
|
14
13
|
from types import SimpleNamespace
|
|
15
14
|
|
|
15
|
+
|
|
16
16
|
class Term:
|
|
17
17
|
""" Escape sequences; e.g., see:
|
|
18
18
|
- https://en.wikipedia.org/wiki/ANSI_escape_code
|
|
@@ -76,7 +76,7 @@ class SysStat:
|
|
|
76
76
|
""" TBD """
|
|
77
77
|
if not self.fh:
|
|
78
78
|
pathname = '/proc/stat'
|
|
79
|
-
self.fh = open(pathname,
|
|
79
|
+
self.fh = open(pathname, encoding='utf-8')
|
|
80
80
|
self.fh.seek(0)
|
|
81
81
|
|
|
82
82
|
ns = SimpleNamespace(mono=time.monotonic(),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
1
|
"""Boot-scoped, mutable growth ledger for pmemstat's cross-run leak tracking.
|
|
3
2
|
|
|
4
3
|
This module owns the *durable* side of the growth feature. Where the phase-1
|
|
@@ -36,7 +35,7 @@ import os
|
|
|
36
35
|
import socket
|
|
37
36
|
import tempfile
|
|
38
37
|
from datetime import datetime, timezone
|
|
39
|
-
from importlib.metadata import
|
|
38
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
40
39
|
|
|
41
40
|
# Schema version. Bump only for an incompatible change; a stored ledger whose
|
|
42
41
|
# ``v`` is not exactly this value is refused (treated as empty).
|
|
@@ -154,7 +153,7 @@ def _state_path(name, create=False):
|
|
|
154
153
|
def current_boot():
|
|
155
154
|
"""Contents of the kernel boot UUID, or ``''`` when unavailable."""
|
|
156
155
|
try:
|
|
157
|
-
with open(BOOT_ID_PATH,
|
|
156
|
+
with open(BOOT_ID_PATH, encoding='ascii') as handle:
|
|
158
157
|
return handle.read().strip()
|
|
159
158
|
except OSError:
|
|
160
159
|
return ''
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
"""
|
|
4
3
|
Module to kill a set of processes and ensure they are really gone.
|
|
5
4
|
"""
|
|
6
5
|
# pylint: disable=broad-except,invalid-name,too-few-public-methods
|
|
7
6
|
|
|
8
7
|
import os
|
|
9
|
-
import sys
|
|
10
8
|
import signal
|
|
9
|
+
import sys
|
|
11
10
|
import time
|
|
12
11
|
import traceback
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
|
|
14
|
+
class KillThem:
|
|
15
15
|
"""Class to help kill a bunch of processes"""
|
|
16
16
|
def __init__(self, pids):
|
|
17
17
|
if isinstance(pids, (list, set, dict)):
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
"""Durable UI preferences for pmemstat (the colour theme and whether colour is on).
|
|
2
|
+
"""Durable UI preferences for pmemstat (the colour theme).
|
|
4
3
|
|
|
5
4
|
This is deliberately *not* :mod:`pmemstat.History`. The history ledger is
|
|
6
5
|
per-boot bookkeeping that belongs in a temp directory; these are user
|
|
@@ -33,14 +32,18 @@ APP_DIR = 'pmemstat'
|
|
|
33
32
|
#: Preference file name inside the app directory.
|
|
34
33
|
FILE_NAME = 'ui.json'
|
|
35
34
|
|
|
36
|
-
#: Every preference and its type. The type is enforced on load and on set:
|
|
37
|
-
#:
|
|
35
|
+
#: Every preference and its type. The type is enforced on load and on set: a
|
|
36
|
+
#: hand-edited ``"theme": 5`` must be ignored, not treated as a name, and an
|
|
38
37
|
#: unknown key must never appear in the saved file.
|
|
38
|
+
#:
|
|
39
|
+
#: There is deliberately no ``colors`` key: in console-window 3.x ``mono`` is a
|
|
40
|
+
#: real theme and selecting it is what turns semantic colour off, so a palette
|
|
41
|
+
#: and a separate on/off flag can no longer disagree. A pre-3.1 store that
|
|
42
|
+
#: remembered ``colors: false`` is migrated on load (see :meth:`UiPrefs.load`).
|
|
39
43
|
DEFAULTS = {
|
|
40
|
-
# '' means "whatever console-window calls the default"; 'mono' is
|
|
41
|
-
#
|
|
44
|
+
# '' means "whatever console-window calls the default"; 'mono' is the
|
|
45
|
+
# library's real no-colour theme.
|
|
42
46
|
'theme': '',
|
|
43
|
-
'colors': True,
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
|
|
@@ -123,10 +126,15 @@ class UiPrefs:
|
|
|
123
126
|
return
|
|
124
127
|
if not isinstance(loaded, dict):
|
|
125
128
|
return
|
|
129
|
+
# Pre-3.1 stores kept a palette beside a separate colour switch. With
|
|
130
|
+
# one value now, a remembered "colour off" becomes the mono theme; the
|
|
131
|
+
# obsolete key is dropped on the next save like any unknown key.
|
|
132
|
+
if loaded.get('colors') is False:
|
|
133
|
+
loaded['theme'] = 'mono'
|
|
126
134
|
for key, default in DEFAULTS.items():
|
|
127
135
|
value = loaded.get(key)
|
|
128
136
|
# Compare types exactly: bool is an int subclass, so a corrupt
|
|
129
|
-
# "
|
|
137
|
+
# "theme": 1 would otherwise pass an isinstance() test.
|
|
130
138
|
if type(value) is type(default): # pylint: disable=unidiomatic-typecheck
|
|
131
139
|
self.values[key] = value
|
|
132
140
|
if set(loaded) - set(DEFAULTS):
|