Skip to content

Commit bcd06bd

Browse files
authored
Merge pull request #6 from metaspartan/development
mactop v2.0.1
2 parents 19c4cbb + ba66b67 commit bcd06bd

20 files changed

+1962
-249
lines changed

README.md

Lines changed: 216 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,20 @@
2323
- Detailed native metrics for CPU cores (E and P cores) via Apple's Mach Kernel API
2424
- Memory usage and swap information
2525
- Network usage information (upload/download speeds)
26+
- **Thunderbolt bandwidth monitoring**: Real-time throughput for Thunderbolt Bridge interfaces
27+
- **Thunderbolt Device Tree**: Visual tree of connected Thunderbolt/USB4 devices and their speeds
28+
- **RDMA Support**: Detection of RDMA over Thunderbolt 5 availability
2629
- Disk I/O activity (read/write speeds)
2730
- Multiple volume display (shows Mac HD + mounted external volumes)
2831
- Easy-to-read terminal UI
29-
- **10 Layouts**: (`L` to cycle layouts)
32+
- **11 Layouts**: (`L` to cycle layouts)
3033
- **Persistent Settings**: Remembers your Layout and Theme choice across restarts
31-
- Customizable UI color (green, red, blue, skyblue, magenta, yellow, gold, silver, white, lime, orange, violet, and pink) (`C` to cycle colors)
34+
- Customizable UI color (green, red, blue, skyblue, magenta, yellow, gold, silver, white, lime, orange, violet, pink, and more) (`C` to cycle colors)
3235
- Customizable update interval (default is 1000ms) (`-` or `=` to speed up, `+` to slow down)
3336
- Process list matching htop format (VIRT in GB, CPU normalized by core count)
3437
- **Process Management**: Kill processes directly from the UI (F9). List pauses while selecting.
3538
- **Headless Mode**: Output JSON metrics to stdout for scripting/logging (`--headless`)
39+
- **JSON Formatting**: Pretty print JSON output (`--pretty`) or set collection count (`--count <n>`)
3640
- Party Mode (Randomly cycles through colors) (P to toggle)
3741
- Optional Prometheus Metrics server (default is disabled) (`-p <port>` or `--prometheus <port>`)
3842
- Support for all Apple Silicon models
@@ -95,10 +99,20 @@ Example with flags:
9599
mactop --interval 1000 --color green
96100
```
97101

102+
Headless Mode (JSON Output):
103+
```bash
104+
# Run once and exit (great for scripts)
105+
mactop --headless --count 1
106+
107+
# Run continuously with pretty printing
108+
mactop --headless --pretty
109+
```
110+
98111
## mactop Flags
99112

100113
- `--headless`: Run in headless mode (no TUI, output JSON to stdout).
101114
- `--count`: Number of samples to collect in headless mode (0 = infinite).
115+
- `--pretty`: Pretty print JSON output in headless mode.
102116
- `--interval` or `-i`: Set the update interval in milliseconds. Default is 1000.
103117
- `--color` or `-c`: Set the UI color. Default is white.
104118
Options are 'green', 'red', 'blue', 'skyblue', 'magenta', 'yellow', 'gold', 'silver', 'white', 'lime', 'orange', 'violet', and 'pink'. (-c green)
@@ -116,6 +130,7 @@ Use the following keys to interact with the application while its running:
116130
- `r`: Refresh the UI data manually.
117131
- `c`: Cycle through the color themes.
118132
- `p`: Party Mode (Randomly cycles through colors)
133+
- `i`: Toggle Info layout (displays system info)
119134
- `l`: Cycle through the 10 available layouts.
120135
- `+` or `=`: Increase update interval (slower updates).
121136
- `-`: Decrease update interval (faster updates).
@@ -131,74 +146,209 @@ Use the following keys to interact with the application while its running:
131146
## Example Headless Output (mactop --headless --count 1)
132147

133148
```json
134-
[
135-
{
136-
"timestamp":"2025-12-04T00:43:06-07:00",
137-
"soc_metrics":{
138-
"cpu_power":5.971,
139-
"gpu_power":1.43491417,
140-
"ane_power":0,
141-
"dram_power":4.119,
142-
"gpu_sram_power":0.04,
143-
"system_power":45.92987823486328,
144-
"total_power":11.564914169999998,
145-
"gpu_freq_mhz":645,
146-
"soc_temp":66.51124,
147-
"cpu_temp":66.51124,
148-
"gpu_temp":59.767166
149+
[{
150+
"timestamp": "2025-12-22T18:16:57-07:00",
151+
"soc_metrics": {
152+
"cpu_power": 2.1959999999999997,
153+
"gpu_power": 5.38552801,
154+
"ane_power": 0,
155+
"dram_power": 5.702,
156+
"gpu_sram_power": 0.158,
157+
"system_power": 37.47166092432617,
158+
"total_power": 50.91318893432617,
159+
"gpu_freq_mhz": 643,
160+
"soc_temp": 62.562572,
161+
"cpu_temp": 62.562572,
162+
"gpu_temp": 58.38886
163+
},
164+
"memory": {
165+
"total": 137438953472,
166+
"used": 74062512128,
167+
"available": 63376441344,
168+
"swap_total": 5368709120,
169+
"swap_used": 4094689280
170+
},
171+
"net_disk": {
172+
"out_packets_per_sec": 589.4371024829012,
173+
"out_bytes_per_sec": 196028.18012655922,
174+
"in_packets_per_sec": 593.3256375185223,
175+
"in_bytes_per_sec": 74461.55739710879,
176+
"read_ops_per_sec": 0.32404458630175986,
177+
"write_ops_per_sec": 40.18152870141822,
178+
"read_kbytes_per_sec": 1.2961783452070395,
179+
"write_kbytes_per_sec": 308.4904461592754
180+
},
181+
"cpu_usage": 15.140564910346725,
182+
"gpu_usage": 53.51970510465884,
183+
"core_usages": [
184+
42.244224422442244,
185+
37.17105263157895,
186+
55.26315789473685,
187+
37.704918032786885,
188+
27.21311475409836,
189+
21.241830065359476,
190+
14.563106796116504,
191+
6.148867313915858,
192+
4.193548387096775,
193+
1.9417475728155338,
194+
30.718954248366014,
195+
20.846905537459286,
196+
1.9417475728155338,
197+
1.2944983818770228,
198+
0.3236245954692557,
199+
0,
200+
0,
201+
0,
202+
0,
203+
0
204+
],
205+
"system_info": {
206+
"name": "Apple M1 Ultra",
207+
"core_count": 20,
208+
"e_core_count": 4,
209+
"p_core_count": 16,
210+
"gpu_core_count": 64
211+
},
212+
"thermal_state": "Normal",
213+
"thunderbolt_info": {
214+
"buses": [
215+
{
216+
"name": "TB4 Bus 5",
217+
"status": "Active (USB)",
218+
"icon": "",
219+
"speed": "Up to 40 Gb/s",
220+
"domain_uuid": "9FDBA52F-DF7C-425E-B67B-FB80F9E1DCD6",
221+
"switch_uid": "0x05AC38BE5E390FE5",
222+
"receptacle_id": "6",
223+
"devices": [
224+
{
225+
"name": "ASM236X NVME",
226+
"mode": "USB",
227+
"info_string": "USB, SSD"
228+
}
229+
],
230+
"network_stats": {
231+
"interface_name": "en7",
232+
"bytes_in": 0,
233+
"bytes_out": 0,
234+
"bytes_in_per_sec": 0,
235+
"bytes_out_per_sec": 0,
236+
"packets_in": 0,
237+
"packets_out": 0
238+
}
239+
},
240+
{
241+
"name": "TB4 Bus 4",
242+
"status": "Inactive",
243+
"icon": "",
244+
"speed": "Up to 40 Gb/s",
245+
"domain_uuid": "5DD6DE43-051D-4B32-B044-23E57AA0EEC8",
246+
"switch_uid": "0x05AC38BE5E390FE4",
247+
"receptacle_id": "5",
248+
"network_stats": {
249+
"interface_name": "en6",
250+
"bytes_in": 0,
251+
"bytes_out": 0,
252+
"bytes_in_per_sec": 0,
253+
"bytes_out_per_sec": 0,
254+
"packets_in": 0,
255+
"packets_out": 0
256+
}
149257
},
150-
"memory":{
151-
"total":137438953472,
152-
"used":95795822592,
153-
"available":41643130880,
154-
"swap_total":21474836480,
155-
"swap_used":20288831488
258+
{
259+
"name": "TB4 @ TB3 Bus 3",
260+
"status": "Active",
261+
"icon": "ϟ",
262+
"speed": "20 Gb/s",
263+
"domain_uuid": "AF4CE493-9005-4E9D-8B8B-0198D27BABA3",
264+
"switch_uid": "0x05AC38BE5E390FE3",
265+
"receptacle_id": "4",
266+
"devices": [
267+
{
268+
"name": "Studio Display",
269+
"vendor": "Apple Inc.",
270+
"vendor_id": "0x0001",
271+
"mode": "TB3",
272+
"switch_uid": "0x0001AFBD0C588A00",
273+
"device_id": "0x801F",
274+
"info_string": "Apple Inc., TB3"
275+
}
276+
],
277+
"network_stats": {
278+
"interface_name": "en5",
279+
"bytes_in": 0,
280+
"bytes_out": 0,
281+
"bytes_in_per_sec": 0,
282+
"bytes_out_per_sec": 0,
283+
"packets_in": 0,
284+
"packets_out": 0
285+
}
156286
},
157-
"net_disk":{
158-
"out_packets_per_sec":333.8985188256889,
159-
"out_bytes_per_sec":164.55632002792703,
160-
"in_packets_per_sec":295.37176665349403,
161-
"in_bytes_per_sec":39.33046303000927,
162-
"read_ops_per_sec":2.6754689008468664,
163-
"write_ops_per_sec":275.5732967872272,
164-
"read_kbytes_per_sec":43.83488247147506,
165-
"write_kbytes_per_sec":3763.2246601761335
287+
{
288+
"name": "TB4 Bus 2",
289+
"status": "Inactive",
290+
"icon": "",
291+
"speed": "Up to 40 Gb/s",
292+
"domain_uuid": "D589EEFE-98CF-42EC-A729-6C3E523AA321",
293+
"switch_uid": "0x05AC38BE5E390FE2",
294+
"receptacle_id": "3",
295+
"network_stats": {
296+
"interface_name": "en4",
297+
"bytes_in": 0,
298+
"bytes_out": 0,
299+
"bytes_in_per_sec": 0,
300+
"bytes_out_per_sec": 0,
301+
"packets_in": 0,
302+
"packets_out": 0
303+
}
166304
},
167-
"cpu_usage":24.052424536171074,
168-
"gpu_usage":13.709099344350134,
169-
"core_usages":[
170-
55.73770491803278,
171-
48.08743169398907,
172-
64.32432432432432,
173-
53.51351351351351,
174-
39.45945945945946,
175-
32.432432432432435,
176-
31.182795698924732,
177-
18.71657754010695,
178-
12.365591397849462,
179-
10.21505376344086,
180-
60,
181-
40.54054054054054,
182-
5.347593582887701,
183-
2.6737967914438503,
184-
2.1505376344086025,
185-
1.0810810810810811,
186-
1.06951871657754,
187-
1.0752688172043012,
188-
1.0752688172043012,
189-
0
190-
],
191-
"system_info":{
192-
"name":"Apple M1 Ultra",
193-
"core_count":20,
194-
"e_core_count":4,
195-
"p_core_count":16,
196-
"gpu_core_count":64
305+
{
306+
"name": "TB4 Bus 1",
307+
"status": "Inactive",
308+
"icon": "",
309+
"speed": "Up to 40 Gb/s",
310+
"domain_uuid": "6DAC6FCD-E102-4CCD-9D01-A75540E660CA",
311+
"switch_uid": "0x05AC38BE5E390FE1",
312+
"receptacle_id": "2",
313+
"network_stats": {
314+
"interface_name": "en3",
315+
"bytes_in": 0,
316+
"bytes_out": 0,
317+
"bytes_in_per_sec": 0,
318+
"bytes_out_per_sec": 0,
319+
"packets_in": 0,
320+
"packets_out": 0
321+
}
197322
},
198-
"thermal_state":"Moderate",
199-
"cpu_temp":66.51124,
200-
"gpu_temp":59.767166
201-
}
323+
{
324+
"name": "TB4 Bus 0",
325+
"status": "Inactive",
326+
"icon": "",
327+
"speed": "Up to 40 Gb/s",
328+
"domain_uuid": "63A80A32-E70C-4F22-84BE-EDE632A5BA3E",
329+
"switch_uid": "0x05AC38BE5E390FE0",
330+
"receptacle_id": "1",
331+
"network_stats": {
332+
"interface_name": "en2",
333+
"bytes_in": 0,
334+
"bytes_out": 0,
335+
"bytes_in_per_sec": 0,
336+
"bytes_out_per_sec": 0,
337+
"packets_in": 0,
338+
"packets_out": 0
339+
}
340+
}
341+
]
342+
},
343+
"tb_net_total_bytes_in_per_sec": 0,
344+
"tb_net_total_bytes_out_per_sec": 0,
345+
"rdma_status": {
346+
"available": false,
347+
"status": "RDMA Disabled (use rdma_ctl enable in Recovery Mode)"
348+
},
349+
"cpu_temp": 62.562572,
350+
"gpu_temp": 58.38886
351+
}
202352
]
203353
```
204354

0 commit comments

Comments
 (0)