macpm 2.1__tar.gz → 2.2__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.
Files changed (43) hide show
  1. {macpm-2.1 → macpm-2.2}/CHANGELOG.md +45 -1
  2. {macpm-2.1/macpm.egg-info → macpm-2.2}/PKG-INFO +105 -21
  3. {macpm-2.1 → macpm-2.2}/README.md +104 -20
  4. {macpm-2.1 → macpm-2.2}/RELEASE.md +11 -11
  5. {macpm-2.1 → macpm-2.2}/macpm/__init__.py +1 -1
  6. {macpm-2.1 → macpm-2.2}/macpm/macpm.py +182 -16
  7. macpm-2.2/macpm/netinfo.py +326 -0
  8. macpm-2.2/macpm/network.py +735 -0
  9. {macpm-2.1 → macpm-2.2}/macpm/processes.py +11 -69
  10. {macpm-2.1 → macpm-2.2}/macpm/sampler.py +3 -3
  11. {macpm-2.1 → macpm-2.2}/macpm/sensors.py +23 -18
  12. macpm-2.2/macpm/tui.py +79 -0
  13. {macpm-2.1 → macpm-2.2/macpm.egg-info}/PKG-INFO +105 -21
  14. {macpm-2.1 → macpm-2.2}/macpm.egg-info/SOURCES.txt +5 -0
  15. {macpm-2.1 → macpm-2.2}/packaging/README.txt +1 -1
  16. {macpm-2.1 → macpm-2.2}/packaging/build.sh +2 -2
  17. {macpm-2.1 → macpm-2.2}/setup.py +1 -1
  18. {macpm-2.1 → macpm-2.2}/tests/test_cli.py +2 -1
  19. {macpm-2.1 → macpm-2.2}/tests/test_layout.py +79 -1
  20. macpm-2.2/tests/test_netinfo.py +295 -0
  21. macpm-2.2/tests/test_network.py +495 -0
  22. {macpm-2.1 → macpm-2.2}/tests/test_sensors.py +21 -24
  23. {macpm-2.1 → macpm-2.2}/LICENSE +0 -0
  24. {macpm-2.1 → macpm-2.2}/MANIFEST.in +0 -0
  25. {macpm-2.1 → macpm-2.2}/macpm/__main__.py +0 -0
  26. {macpm-2.1 → macpm-2.2}/macpm/dump.py +0 -0
  27. {macpm-2.1 → macpm-2.2}/macpm/ioreport.py +0 -0
  28. {macpm-2.1 → macpm-2.2}/macpm/smc.py +0 -0
  29. {macpm-2.1 → macpm-2.2}/macpm/soc.py +0 -0
  30. {macpm-2.1 → macpm-2.2}/macpm.egg-info/dependency_links.txt +0 -0
  31. {macpm-2.1 → macpm-2.2}/macpm.egg-info/entry_points.txt +0 -0
  32. {macpm-2.1 → macpm-2.2}/macpm.egg-info/not-zip-safe +0 -0
  33. {macpm-2.1 → macpm-2.2}/macpm.egg-info/requires.txt +0 -0
  34. {macpm-2.1 → macpm-2.2}/macpm.egg-info/top_level.txt +0 -0
  35. {macpm-2.1 → macpm-2.2}/packaging/entry_tui.py +0 -0
  36. {macpm-2.1 → macpm-2.2}/packaging/install.sh +0 -0
  37. {macpm-2.1 → macpm-2.2}/packaging/macpm.command +0 -0
  38. {macpm-2.1 → macpm-2.2}/pyproject.toml +0 -0
  39. {macpm-2.1 → macpm-2.2}/setup.cfg +0 -0
  40. {macpm-2.1 → macpm-2.2}/tests/__init__.py +0 -0
  41. {macpm-2.1 → macpm-2.2}/tests/test_calc_freq.py +0 -0
  42. {macpm-2.1 → macpm-2.2}/tests/test_processes.py +0 -0
  43. {macpm-2.1 → macpm-2.2}/tests/test_sampler.py +0 -0
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2 — 2026-11-12
4
+
5
+ ### Added
6
+
7
+ - **Network view** on key `4` — a rootless overview built from `nettop`: TCP
8
+ socket counts by state (`ESTABLISHED`, `LISTEN`, `CLOSE_WAIT`, `TIME_WAIT`),
9
+ UDP socket count, interface throughput, a listening table (address, PID,
10
+ process) and a per-process traffic table with socket count and download /
11
+ upload rates. `Tab` switches the focused table, `s` cycles its sort column,
12
+ `↑` / `↓` scroll it and `Space` pauses sampling. The traffic table
13
+ refreshes every 2 seconds and the full socket snapshot every 5 seconds while
14
+ the view is open. `nettop` needs no root and sees sockets owned by root
15
+ daemons; sockets without an owner (typically `TIME_WAIT`) are not reported.
16
+ - The network summary box has a line with the active IPv4 interface and prefix,
17
+ the default gateway, and the public IP with its city. For Chinese addresses
18
+ the carrier abbreviation (Telecom, Unicom, Mobile) is appended after the
19
+ country code, e.g. `Shanghai, CN Telecom`.
20
+ The public lookup is one HTTPS request to `ipinfo.io` (falling back to
21
+ `ipwho.is`), cached for 10 minutes and disabled with `--no-public-ip`.
22
+
23
+ ### Changed
24
+
25
+ - The network summary uses fixed-width fields, so the labels no longer move as
26
+ the counter and rate values change. The traffic table is sorted by the
27
+ visible `↓/s` column by default; the combined rate is no longer a hidden sort
28
+ key.
29
+ - The Temps & Fans panel now pairs each component's temperature with its peak
30
+ (CPU on one row, GPU on the next), followed by fan RPMs and one fan-load bar
31
+ per fan. The bars omit the numeric percentage so they can use the full panel
32
+ width. The network identity line is only shown in view 1, not in the
33
+ per-core view.
34
+ - README: screenshots for the process and network views and refreshed
35
+ highlights.
36
+
37
+ ### Fixed
38
+
39
+ - Arrow keys were delivered as a bare `ESC` — which quits macpm — because the
40
+ curses window never enabled keypad mode. `↑` / `↓` now scroll the process
41
+ and network tables as documented.
42
+ - The views reset only the foreground colour after drawing, not the whole SGR
43
+ state. A full reset also cleared the black background set by curses, so the
44
+ terminal profile's background (often grey) showed through in the default,
45
+ process and network views.
46
+
3
47
  ## 2.1 — 2026-11-11
4
48
 
5
49
  ### Changed
@@ -15,7 +59,7 @@
15
59
 
16
60
  - **Temps & Fans panel** in the default view — hottest CPU and GPU sensor in
17
61
  °C and the current RPM of every fan, read from `AppleSMC` without root.
18
- - **Process view** on key `3` — a macmon-style two-box layout: a
62
+ - **Process view** on key `3` — a two-box layout: a
19
63
  CPU/GPU/RAM summary box (with wired/active/inactive/free memory) and a
20
64
  process table with PID, NAME, USER, CPU%, MEM and GPU% columns, sorted with
21
65
  `s`, scrolled with `↑`/`↓` and paused with `Space`. The table refreshes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: macpm
3
- Version: 2.1
3
+ Version: 2.2
4
4
  Summary: Rootless performance monitoring CLI tool for Apple Silicon
5
5
  Home-page: https://github.com/visualcjy/macpm
6
6
  Author: Jinyu Chen
@@ -42,7 +42,7 @@ Dynamic: summary
42
42
  # macpm
43
43
 
44
44
  **Rootless performance monitoring CLI for Apple Silicon.**<br>
45
- macpm 2.1 reads the same hardware counters as `powermetrics`, but through
45
+ macpm 2.2 reads the same hardware counters as `powermetrics`, but through
46
46
  IOReport/IOKit/SMC — no `sudo`, no password, no privileged helper.
47
47
 
48
48
  A Python-based `nvtop`-inspired terminal monitor for Apple Silicon Macs,
@@ -63,6 +63,14 @@ Per-core view (`--show_cores`, or press `2` while running):
63
63
 
64
64
  ![macpm per-core view](https://raw.githubusercontent.com/visualcjy/macpm/main/images/v2.png)
65
65
 
66
+ Process view (press `3` while running):
67
+
68
+ ![macpm process view](https://raw.githubusercontent.com/visualcjy/macpm/main/images/v3.png)
69
+
70
+ Network view (press `4` while running):
71
+
72
+ ![macpm network view](https://raw.githubusercontent.com/visualcjy/macpm/main/images/v4.png)
73
+
66
74
  ## Highlights
67
75
 
68
76
  - **No sudo required.** `macpm` runs as a normal user process.
@@ -70,9 +78,13 @@ Per-core view (`--show_cores`, or press `2` while running):
70
78
  - GPU utilisation and frequency
71
79
  - CPU / GPU / ANE power, rolling average, peaks and throttle state
72
80
  - RAM and swap usage
73
- - CPU/GPU temperature and fan RPM panel (SMC, read-only, no root)
81
+ - CPU/GPU temperature, peak and fan-load panel (SMC, read-only, no root)
74
82
  - Disk IOPS/throughput and network throughput
75
- - Process view with per-process CPU, memory and GPU usage, sortable with `s`
83
+ - Process view (`3`) with per-process CPU, memory and GPU usage, sortable with `s`
84
+ - Network view (`4`) with TCP state counts, listening ports, per-process traffic
85
+ and the local/public IP, gateway and city
86
+ - Key-hint footer in every view; the default view also fills the terminal and
87
+ shows the network identity in the processor box when there is room
76
88
  - Familiar terminal layout, colours, charts and key bindings from macpm 0.x
77
89
 
78
90
  ## Install
@@ -98,7 +110,7 @@ Prefer a standalone binary with no Python installation? See
98
110
  ## Usage
99
111
 
100
112
  ```text
101
- macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [--version]
113
+ macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [--no-public-ip] [--version]
102
114
  ```
103
115
 
104
116
  | Option | Meaning |
@@ -107,18 +119,20 @@ macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [-
107
119
  | `--color 1-8` | Display colour (default `2`) |
108
120
  | `--avg SECONDS` | Averaging window for power values (default `30`) |
109
121
  | `--show_cores [BOOL]` | Start in the per-core view |
122
+ | `--no-public-ip` | Do not look up the public IP and location |
110
123
  | `--version` | Print the version |
111
124
 
112
- Keys:
125
+ The default view also has a footer with the key hints. Keys:
113
126
 
114
127
  ```text
115
- q / ESC quit
116
- ← / → change colour
117
- 1 / 2 / 3 default / per-core / process view
118
- s cycle the process sort column (process view)
119
- ↑ / ↓ scroll the process list (process view)
120
- Space pause / resume the process list (process view)
121
- Ctrl+R reset peaks
128
+ q / ESC quit
129
+ ← / → change colour
130
+ 1 / 2 / 3 / 4 default / per-core / process / network view
131
+ s cycle the sort column (process / network view)
132
+ ↑ / ↓ scroll the list or the focused network pane
133
+ Space pause / resume the list (process / network view)
134
+ Tab switch the focused network pane
135
+ Ctrl+R reset peaks
122
136
  ```
123
137
 
124
138
  ## Colour themes
@@ -146,7 +160,10 @@ requires root and Apple's private entitlements.
146
160
  | GPU load and frequency | IOReport `GPU Stats` / `GPU Performance States` |
147
161
  | CPU / GPU / ANE power | IOReport `Energy Model` |
148
162
  | RAM / swap | `psutil` |
149
- | Disk / network | `psutil` counters |
163
+ | Disk / network throughput | `psutil` counters |
164
+ | Sockets, listeners, per-process traffic | `nettop` |
165
+ | Local IP / prefix / gateway | `psutil`, `route -n get default` |
166
+ | Public IP / city | `ipinfo.io` (fallback `ipwho.is`) |
150
167
  | Per-process CPU / memory | `psutil`, plus `/bin/ps` for other users |
151
168
  | Per-process GPU | `IOAccelerator` user clients in the IORegistry |
152
169
  | CPU/GPU temperature, fan RPM | `AppleSMC` via the IOKit user client |
@@ -160,14 +177,19 @@ M1–M3 store Hz there, M4+ store kHz.
160
177
  ## Temperatures and fans
161
178
 
162
179
  The default view has a **Temps & Fans** box next to the memory gauge. It shows
163
- the hottest CPU and GPU sensor in °C and the current RPM of every fan, for
164
- example:
180
+ the hottest CPU and GPU sensor with their peaks since the last reset (CPU on
181
+ one row, GPU on the next), the current RPM of every fan, and a fan-load bar
182
+ for each fan (current speed as a
183
+ percentage of its maximum RPM, without a numeric percentage so the bars can
184
+ use the full panel width):
165
185
 
166
186
  ```text
167
- ┌ Temps & Fans ──────────────────────────┐
168
- │ CPU 52.4°C GPU 43.1°C │
169
- │ Fan 1 2318 rpm Fan 2 2502 rpm │
170
- └────────────────────────────────────────┘
187
+ ┌ Temps & Fans ────────────────────────────────┐
188
+ │ CPU 52.4°C peak 61.5°C │
189
+ │ GPU 43.1°C peak 50.0°C │
190
+ │ Fan 1 2318 rpm Fan 2 2502 rpm │
191
+ │ F1 ▉▉▉▉▉▉▉▉▉▉▉▉ F2 ▉▉▉▉▉▉▉▉▉▉▉▉▉ │
192
+ └──────────────────────────────────────────────┘
171
193
  ```
172
194
 
173
195
  The values come from `AppleSMC` through the IOKit user client (read-only, no
@@ -177,7 +199,7 @@ Fan **control** requires root and is not implemented.
177
199
 
178
200
  ## Process view
179
201
 
180
- Press `3` for a macmon-style two-box layout. The top box is titled with the
202
+ Press `3` for a two-box layout. The top box is titled with the
181
203
  SoC and core counts (as in views 1/2) and keeps the top-style CPU (E/P
182
204
  percentages and frequencies), GPU (%, MHz), RAM/swap and
183
205
  wired/active/inactive/free memory summary. The second box is the
@@ -195,6 +217,63 @@ owned by other users (so system processes such as WindowServer appear too).
195
217
  GPU usage is the GPU time of the process' `IOAccelerator` user clients;
196
218
  processes without a readable GPU client show `0.0`.
197
219
 
220
+ ## Network view
221
+
222
+ Press `4` for a network overview built from `nettop`. The summary box shows
223
+ the TCP socket count per state (`ESTABLISHED`, `LISTEN`, `CLOSE_WAIT`,
224
+ `TIME_WAIT`), the UDP socket count and the current interface throughput. Below
225
+ it the traffic table lists the busiest processes with their socket count and
226
+ per-process download/upload rate, and the listening table lists every TCP
227
+ listening socket with its bind address, PID and process. The traffic table is
228
+ sorted by download rate (`↓/s`) by default. `Tab` moves the focus between the
229
+ two tables, `s` cycles the sort column of the focused table (download, upload,
230
+ connections, PID, name), `↑` / `↓` scroll it and `Space` pauses sampling. The
231
+ two tables are shown side by side on terminals at least 110 columns wide and
232
+ stacked otherwise; the listening table is hidden when the terminal is narrower
233
+ than 60 columns or too short for two panes.
234
+
235
+ Per-process rates are the difference between the cumulative byte counters that
236
+ `nettop` reports; the first sample after entering the view is the baseline. The
237
+ traffic table refreshes every 2 seconds from a per-process snapshot, the
238
+ socket/listening data every 5 seconds from a full snapshot. Both only run
239
+ while the view is open.
240
+
241
+ The network view's summary box has a line with the active IPv4 interface and
242
+ prefix, the default gateway, and the public IP with its city. View 1 shows the
243
+ same line in a spare row of the Processor box when there is one; the per-core
244
+ view leaves that row empty. For example:
245
+
246
+ ```text
247
+ ┌ Network ─────────────────────────────────────────────────────────────────────┐
248
+ │ en0 192.168.1.23/24 · gw 192.168.1.1 · 203.0.113.45 Nanning, CN Unicom │
249
+ │ TCP 115 EST 61 LISTEN 27 CLOSE_WAIT 25 TIME_WAIT 1 UDP 70 │
250
+ │ ↓ 11K/s ↑ 4.0K/s sockets 185 processes 39 │
251
+ └──────────────────────────────────────────────────────────────────────────────┘
252
+ ```
253
+
254
+ The local values come from `psutil` and `route -n get default` and refresh
255
+ every 30 seconds while the default or network view is open. The public values
256
+ come from a background HTTPS request to `ipinfo.io`, falling back to
257
+ `ipwho.is`; for a Chinese address the carrier abbreviation (Telecom, Unicom,
258
+ Mobile) is appended after the country code, e.g. `Shanghai, CN Telecom`. A successful answer is cached
259
+ for 10 minutes and a failed one is retried after a minute. The lookup starts when a view that shows the line is
260
+ first drawn — the default view at startup, or the network view — and it
261
+ necessarily reveals your public IP to the service; pass `--no-public-ip` to
262
+ disable it. On a narrow terminal the line is clipped with an ellipsis. This
263
+ lookup is the only network request macpm makes.
264
+
265
+ `nettop` runs without root and, unlike `lsof -i`, sees sockets owned by other
266
+ users, so root daemons such as `launchd` and `mDNSResponder` appear in the
267
+ listening table. Three limitations follow from the data source:
268
+
269
+ - `nettop` does not report sockets without an owning process (typically
270
+ `TIME_WAIT`), so the total is lower than a raw `netstat -an` count;
271
+ `ESTABLISHED`, `LISTEN` and `CLOSE_WAIT` match.
272
+ - Byte counters include loopback traffic, so the sum of per-process rates can
273
+ be higher than the interface total in the summary.
274
+ - Process names are truncated to about 15 characters, the same `comm` limit
275
+ shown in the process view.
276
+
198
277
  ## Compatibility
199
278
 
200
279
  Tested on macOS 27.2 with an M3 Max. Behaviour depends more on the chip
@@ -266,6 +345,11 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
266
345
  could not be opened on this macOS build; the rest of macpm still works.
267
346
  - **A temperature shows `--`** — not every SMC key exists on every chip; the
268
347
  reader only reports the keys that are present.
348
+ - **The network view says `nettop unavailable`** — `/usr/bin/nettop` is
349
+ missing or could not run. The other views keep working.
350
+ - **The network header has no public IP** — the lookup is disabled with
351
+ `--no-public-ip`, or the machine is offline / the service is blocked. The
352
+ local IP, prefix and gateway still show.
269
353
 
270
354
  ## Changelog
271
355
 
@@ -1,7 +1,7 @@
1
1
  # macpm
2
2
 
3
3
  **Rootless performance monitoring CLI for Apple Silicon.**<br>
4
- macpm 2.1 reads the same hardware counters as `powermetrics`, but through
4
+ macpm 2.2 reads the same hardware counters as `powermetrics`, but through
5
5
  IOReport/IOKit/SMC — no `sudo`, no password, no privileged helper.
6
6
 
7
7
  A Python-based `nvtop`-inspired terminal monitor for Apple Silicon Macs,
@@ -22,6 +22,14 @@ Per-core view (`--show_cores`, or press `2` while running):
22
22
 
23
23
  ![macpm per-core view](https://raw.githubusercontent.com/visualcjy/macpm/main/images/v2.png)
24
24
 
25
+ Process view (press `3` while running):
26
+
27
+ ![macpm process view](https://raw.githubusercontent.com/visualcjy/macpm/main/images/v3.png)
28
+
29
+ Network view (press `4` while running):
30
+
31
+ ![macpm network view](https://raw.githubusercontent.com/visualcjy/macpm/main/images/v4.png)
32
+
25
33
  ## Highlights
26
34
 
27
35
  - **No sudo required.** `macpm` runs as a normal user process.
@@ -29,9 +37,13 @@ Per-core view (`--show_cores`, or press `2` while running):
29
37
  - GPU utilisation and frequency
30
38
  - CPU / GPU / ANE power, rolling average, peaks and throttle state
31
39
  - RAM and swap usage
32
- - CPU/GPU temperature and fan RPM panel (SMC, read-only, no root)
40
+ - CPU/GPU temperature, peak and fan-load panel (SMC, read-only, no root)
33
41
  - Disk IOPS/throughput and network throughput
34
- - Process view with per-process CPU, memory and GPU usage, sortable with `s`
42
+ - Process view (`3`) with per-process CPU, memory and GPU usage, sortable with `s`
43
+ - Network view (`4`) with TCP state counts, listening ports, per-process traffic
44
+ and the local/public IP, gateway and city
45
+ - Key-hint footer in every view; the default view also fills the terminal and
46
+ shows the network identity in the processor box when there is room
35
47
  - Familiar terminal layout, colours, charts and key bindings from macpm 0.x
36
48
 
37
49
  ## Install
@@ -57,7 +69,7 @@ Prefer a standalone binary with no Python installation? See
57
69
  ## Usage
58
70
 
59
71
  ```text
60
- macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [--version]
72
+ macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [--no-public-ip] [--version]
61
73
  ```
62
74
 
63
75
  | Option | Meaning |
@@ -66,18 +78,20 @@ macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [-
66
78
  | `--color 1-8` | Display colour (default `2`) |
67
79
  | `--avg SECONDS` | Averaging window for power values (default `30`) |
68
80
  | `--show_cores [BOOL]` | Start in the per-core view |
81
+ | `--no-public-ip` | Do not look up the public IP and location |
69
82
  | `--version` | Print the version |
70
83
 
71
- Keys:
84
+ The default view also has a footer with the key hints. Keys:
72
85
 
73
86
  ```text
74
- q / ESC quit
75
- ← / → change colour
76
- 1 / 2 / 3 default / per-core / process view
77
- s cycle the process sort column (process view)
78
- ↑ / ↓ scroll the process list (process view)
79
- Space pause / resume the process list (process view)
80
- Ctrl+R reset peaks
87
+ q / ESC quit
88
+ ← / → change colour
89
+ 1 / 2 / 3 / 4 default / per-core / process / network view
90
+ s cycle the sort column (process / network view)
91
+ ↑ / ↓ scroll the list or the focused network pane
92
+ Space pause / resume the list (process / network view)
93
+ Tab switch the focused network pane
94
+ Ctrl+R reset peaks
81
95
  ```
82
96
 
83
97
  ## Colour themes
@@ -105,7 +119,10 @@ requires root and Apple's private entitlements.
105
119
  | GPU load and frequency | IOReport `GPU Stats` / `GPU Performance States` |
106
120
  | CPU / GPU / ANE power | IOReport `Energy Model` |
107
121
  | RAM / swap | `psutil` |
108
- | Disk / network | `psutil` counters |
122
+ | Disk / network throughput | `psutil` counters |
123
+ | Sockets, listeners, per-process traffic | `nettop` |
124
+ | Local IP / prefix / gateway | `psutil`, `route -n get default` |
125
+ | Public IP / city | `ipinfo.io` (fallback `ipwho.is`) |
109
126
  | Per-process CPU / memory | `psutil`, plus `/bin/ps` for other users |
110
127
  | Per-process GPU | `IOAccelerator` user clients in the IORegistry |
111
128
  | CPU/GPU temperature, fan RPM | `AppleSMC` via the IOKit user client |
@@ -119,14 +136,19 @@ M1–M3 store Hz there, M4+ store kHz.
119
136
  ## Temperatures and fans
120
137
 
121
138
  The default view has a **Temps & Fans** box next to the memory gauge. It shows
122
- the hottest CPU and GPU sensor in °C and the current RPM of every fan, for
123
- example:
139
+ the hottest CPU and GPU sensor with their peaks since the last reset (CPU on
140
+ one row, GPU on the next), the current RPM of every fan, and a fan-load bar
141
+ for each fan (current speed as a
142
+ percentage of its maximum RPM, without a numeric percentage so the bars can
143
+ use the full panel width):
124
144
 
125
145
  ```text
126
- ┌ Temps & Fans ──────────────────────────┐
127
- │ CPU 52.4°C GPU 43.1°C │
128
- │ Fan 1 2318 rpm Fan 2 2502 rpm │
129
- └────────────────────────────────────────┘
146
+ ┌ Temps & Fans ────────────────────────────────┐
147
+ │ CPU 52.4°C peak 61.5°C │
148
+ │ GPU 43.1°C peak 50.0°C │
149
+ │ Fan 1 2318 rpm Fan 2 2502 rpm │
150
+ │ F1 ▉▉▉▉▉▉▉▉▉▉▉▉ F2 ▉▉▉▉▉▉▉▉▉▉▉▉▉ │
151
+ └──────────────────────────────────────────────┘
130
152
  ```
131
153
 
132
154
  The values come from `AppleSMC` through the IOKit user client (read-only, no
@@ -136,7 +158,7 @@ Fan **control** requires root and is not implemented.
136
158
 
137
159
  ## Process view
138
160
 
139
- Press `3` for a macmon-style two-box layout. The top box is titled with the
161
+ Press `3` for a two-box layout. The top box is titled with the
140
162
  SoC and core counts (as in views 1/2) and keeps the top-style CPU (E/P
141
163
  percentages and frequencies), GPU (%, MHz), RAM/swap and
142
164
  wired/active/inactive/free memory summary. The second box is the
@@ -154,6 +176,63 @@ owned by other users (so system processes such as WindowServer appear too).
154
176
  GPU usage is the GPU time of the process' `IOAccelerator` user clients;
155
177
  processes without a readable GPU client show `0.0`.
156
178
 
179
+ ## Network view
180
+
181
+ Press `4` for a network overview built from `nettop`. The summary box shows
182
+ the TCP socket count per state (`ESTABLISHED`, `LISTEN`, `CLOSE_WAIT`,
183
+ `TIME_WAIT`), the UDP socket count and the current interface throughput. Below
184
+ it the traffic table lists the busiest processes with their socket count and
185
+ per-process download/upload rate, and the listening table lists every TCP
186
+ listening socket with its bind address, PID and process. The traffic table is
187
+ sorted by download rate (`↓/s`) by default. `Tab` moves the focus between the
188
+ two tables, `s` cycles the sort column of the focused table (download, upload,
189
+ connections, PID, name), `↑` / `↓` scroll it and `Space` pauses sampling. The
190
+ two tables are shown side by side on terminals at least 110 columns wide and
191
+ stacked otherwise; the listening table is hidden when the terminal is narrower
192
+ than 60 columns or too short for two panes.
193
+
194
+ Per-process rates are the difference between the cumulative byte counters that
195
+ `nettop` reports; the first sample after entering the view is the baseline. The
196
+ traffic table refreshes every 2 seconds from a per-process snapshot, the
197
+ socket/listening data every 5 seconds from a full snapshot. Both only run
198
+ while the view is open.
199
+
200
+ The network view's summary box has a line with the active IPv4 interface and
201
+ prefix, the default gateway, and the public IP with its city. View 1 shows the
202
+ same line in a spare row of the Processor box when there is one; the per-core
203
+ view leaves that row empty. For example:
204
+
205
+ ```text
206
+ ┌ Network ─────────────────────────────────────────────────────────────────────┐
207
+ │ en0 192.168.1.23/24 · gw 192.168.1.1 · 203.0.113.45 Nanning, CN Unicom │
208
+ │ TCP 115 EST 61 LISTEN 27 CLOSE_WAIT 25 TIME_WAIT 1 UDP 70 │
209
+ │ ↓ 11K/s ↑ 4.0K/s sockets 185 processes 39 │
210
+ └──────────────────────────────────────────────────────────────────────────────┘
211
+ ```
212
+
213
+ The local values come from `psutil` and `route -n get default` and refresh
214
+ every 30 seconds while the default or network view is open. The public values
215
+ come from a background HTTPS request to `ipinfo.io`, falling back to
216
+ `ipwho.is`; for a Chinese address the carrier abbreviation (Telecom, Unicom,
217
+ Mobile) is appended after the country code, e.g. `Shanghai, CN Telecom`. A successful answer is cached
218
+ for 10 minutes and a failed one is retried after a minute. The lookup starts when a view that shows the line is
219
+ first drawn — the default view at startup, or the network view — and it
220
+ necessarily reveals your public IP to the service; pass `--no-public-ip` to
221
+ disable it. On a narrow terminal the line is clipped with an ellipsis. This
222
+ lookup is the only network request macpm makes.
223
+
224
+ `nettop` runs without root and, unlike `lsof -i`, sees sockets owned by other
225
+ users, so root daemons such as `launchd` and `mDNSResponder` appear in the
226
+ listening table. Three limitations follow from the data source:
227
+
228
+ - `nettop` does not report sockets without an owning process (typically
229
+ `TIME_WAIT`), so the total is lower than a raw `netstat -an` count;
230
+ `ESTABLISHED`, `LISTEN` and `CLOSE_WAIT` match.
231
+ - Byte counters include loopback traffic, so the sum of per-process rates can
232
+ be higher than the interface total in the summary.
233
+ - Process names are truncated to about 15 characters, the same `comm` limit
234
+ shown in the process view.
235
+
157
236
  ## Compatibility
158
237
 
159
238
  Tested on macOS 27.2 with an M3 Max. Behaviour depends more on the chip
@@ -225,6 +304,11 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
225
304
  could not be opened on this macOS build; the rest of macpm still works.
226
305
  - **A temperature shows `--`** — not every SMC key exists on every chip; the
227
306
  reader only reports the keys that are present.
307
+ - **The network view says `nettop unavailable`** — `/usr/bin/nettop` is
308
+ missing or could not run. The other views keep working.
309
+ - **The network header has no public IP** — the lookup is disabled with
310
+ `--no-public-ip`, or the machine is offline / the service is blocked. The
311
+ local IP, prefix and gateway still show.
228
312
 
229
313
  ## Changelog
230
314
 
@@ -1,4 +1,4 @@
1
- # Releasing macpm 2.1
1
+ # Releasing macpm 2.2
2
2
 
3
3
  This checklist prepares a GitHub tag and a PyPI upload. It does not push or
4
4
  publish anything by itself.
@@ -7,11 +7,11 @@ publish anything by itself.
7
7
 
8
8
  - macOS Apple Silicon, Python 3.9+.
9
9
  - Clean working tree (`git status`), all tests passing.
10
- - Version is `2.1` in:
10
+ - Version is `2.2` in:
11
11
  - `setup.py`
12
12
  - `macpm/__init__.py`
13
- - `macpm/macpm.py` (`version = 'macpm v2.1'`)
14
- - `CHANGELOG.md` has the 2.1 entry.
13
+ - `macpm/macpm.py` (`version = 'macpm v2.2'`)
14
+ - `CHANGELOG.md` has the 2.2 entry.
15
15
 
16
16
  ## 2. Test from source
17
17
 
@@ -38,7 +38,7 @@ Test the wheel in a **clean** venv (this is the real "no source tree" test):
38
38
 
39
39
  ```sh
40
40
  python3 -m venv /tmp/macpm-wheel-test
41
- /tmp/macpm-wheel-test/bin/pip install dist/macpm-2.1-py3-none-any.whl
41
+ /tmp/macpm-wheel-test/bin/pip install dist/macpm-2.2-py3-none-any.whl
42
42
  /tmp/macpm-wheel-test/bin/macpm --help
43
43
  /tmp/macpm-wheel-test/bin/macpm-dump # Ctrl+C
44
44
  ```
@@ -78,13 +78,13 @@ Manual alternative (fallback, e.g. when OIDC is unavailable):
78
78
  ```sh
79
79
  # requires a PyPI API token in ~/.pypirc or TWINE_PASSWORD
80
80
  python3 -m twine upload --non-interactive \
81
- dist/macpm-2.1.tar.gz dist/macpm-2.1-py3-none-any.whl
81
+ dist/macpm-2.2.tar.gz dist/macpm-2.2-py3-none-any.whl
82
82
  ```
83
83
 
84
84
  Then verify:
85
85
 
86
86
  ```sh
87
- python3 -m pip install --upgrade macpm==2.1
87
+ python3 -m pip install --upgrade macpm==2.2
88
88
  macpm --version
89
89
  ```
90
90
 
@@ -93,10 +93,10 @@ macpm --version
93
93
  ```sh
94
94
  git add setup.py pyproject.toml MANIFEST.in README.md CHANGELOG.md RELEASE.md \
95
95
  macpm packaging tests .github bin
96
- git commit -m "Release macpm 2.1: process view, SMC panel and power fixes"
97
- git tag -a v2.1 -m "macpm 2.1"
96
+ git commit -m "Release macpm 2.2: network view, network identity and sensor panel"
97
+ git tag -a v2.2 -m "macpm 2.2"
98
98
  git push origin main
99
- git push origin v2.1
99
+ git push origin v2.2
100
100
  ```
101
101
 
102
102
  The `Release` workflow builds the sdist/wheel, checks metadata and attaches
@@ -118,7 +118,7 @@ PYTHON=python3 packaging/build.sh
118
118
  This produces:
119
119
 
120
120
  ```text
121
- dist/macpm-2.1-macos-arm64.tar.gz
121
+ dist/macpm-2.2-macos-arm64.tar.gz
122
122
  ```
123
123
 
124
124
  Attach it to the GitHub release. The binaries are ad-hoc signed, not
@@ -1,3 +1,3 @@
1
1
  """macpm: rootless performance monitor for Apple Silicon."""
2
2
 
3
- __version__ = "2.1"
3
+ __version__ = "2.2"