macpm 0.22__tar.gz → 0.24__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.
macpm-0.24/PKG-INFO ADDED
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.1
2
+ Name: macpm
3
+ Version: 0.24
4
+ Summary: Performance monitoring CLI tool for Apple Silicon
5
+ Home-page: https://github.com/visualcjy/macpm
6
+ Author: Jinyu Chen
7
+ Author-email: visualcjy@mail.com
8
+ License: MIT
9
+ Keywords: macpm
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: MacOS
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: dashing
16
+ Requires-Dist: psutil
17
+ Requires-Dist: humanize
18
+
19
+ # macpm
20
+
21
+ PyPI - Downloads (https://pypi.org/project/macpm/#files)
22
+ or: pip install macpm
23
+
24
+ enhanced MAC Performance monitoring CLI tool for Apple Silicon
25
+
26
+ ![](images/macpm-v.gif)
27
+ ![](images/macpm.gif)
28
+ ```shell
29
+ pip install macpm
30
+ ```
31
+
32
+ ## What is `macpm`
33
+
34
+ forked form https://github.com/tlkh/asitop
35
+ 1. fixed the problem that "E-CPU Usage" and "P-CPU Usage" always 100%
36
+ 2. add "Disk IO" and "Network IO" info
37
+ 3. adjust the hard coded max power in CPU/GPU/ANE
38
+ 4. change the way to call powermetrics, no temp files in /tmp
39
+ 5. press ESC or q to quit
40
+ 6. press LEFT or RIGHT to switch color, press 1 : default view, 2 : show_core view
41
+ 7. fix M1 has no "down_ratio" tag problem, fix p-core cpu usage
42
+ press ctrl + r to reset the max and peak record
43
+
44
+ A Python-based `nvtop`-inspired command line tool for Apple Silicon (aka M1) Macs.
45
+
46
+ * Utilization info:
47
+ * CPU (E-cluster and P-cluster), GPU
48
+ * Frequency and utilization
49
+ * ANE utilization (measured by power)
50
+ * Memory info:
51
+ * RAM and swap, size and usage
52
+ * (Apple removed memory bandwidth from `powermetrics`)
53
+ * Power info:
54
+ * CPU power, GPU power (Apple removed package power from `powermetrics`)
55
+ * Chart for CPU/GPU power
56
+ * Peak power, rolling average display
57
+
58
+ `macpm` uses the built-in [`powermetrics`](https://www.unix.com/man-page/osx/1/powermetrics/) utility on macOS, which allows access to a variety of hardware performance counters. Note that it requires `sudo` to run due to `powermetrics` needing root access to run. `macpm` is lightweight and has minimal performance impact.
59
+
60
+ **`macpm` only works on Apple Silicon Macs on macOS Monterey!**
61
+
62
+ ## Installation and Usage
63
+
64
+ `macpm` is a Python-based command line tool. You need `pip` to download and install `macpm`. macOS already comes with Python, to install `pip`, you can follow an [online guide](https://phoenixnap.com/kb/install-pip-mac). After you install `macpm` via `pip`, you can use it via the Terminal.
65
+
66
+ ```shell
67
+ # to enter password before start
68
+ # this mode is recommended!
69
+ sudo macpm
70
+
71
+ # it will prompt password on start
72
+ macpm
73
+
74
+ # advanced options
75
+ macpm [-h] [--interval INTERVAL] [--color COLOR] [--avg AVG]
76
+ optional arguments:
77
+ -h, --help show this help message and exit
78
+ --interval INTERVAL Display interval and sampling interval for powermetrics (seconds)
79
+ --color COLOR Choose display color (0~8)
80
+ --avg AVG Interval for averaged values (seconds)
81
+ ```
82
+
83
+ ## How it works
84
+
85
+ `powermetrics` is used to measure the following:
86
+
87
+ * CPU/GPU utilization via active residency
88
+ * CPU/GPU frequency
89
+ * Package/CPU/GPU/ANE energy consumption
90
+ * CPU/GPU/Media Total memory bandwidth via the DCS (DRAM Command Scheduler)
91
+
92
+ [`psutil`](https://github.com/giampaolo/psutil) is used to measure the following:
93
+
94
+ * memory and swap usage
95
+
96
+ [`sysctl`](https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/sysctl.3.html) is used to measure the following:
97
+
98
+ * CPU name
99
+ * CPU core counts
100
+
101
+ [`system_profiler`](https://ss64.com/osx/system_profiler.html) is used to measure the following:
102
+
103
+ * GPU core count
104
+
105
+ Some information is guesstimate and hardcoded as there doesn't seem to be a official source for it on the system:
106
+
107
+ * CPU/GPU TDP
108
+ * CPU/GPU maximum memory bandwidth
109
+ * ANE max power
110
+ * Media engine max bandwidth
111
+
112
+ ## Why
113
+
114
+ Because I didn't find something like this online. Also, just curious about stuff.
115
+
116
+ ## Disclaimers
117
+
118
+ I did this randomly don't blame me if it fried your new MacBook or something.
@@ -20,6 +20,8 @@ forked form https://github.com/tlkh/asitop
20
20
  4. change the way to call powermetrics, no temp files in /tmp
21
21
  5. press ESC or q to quit
22
22
  6. press LEFT or RIGHT to switch color, press 1 : default view, 2 : show_core view
23
+ 7. fix M1 has no "down_ratio" tag problem, fix p-core cpu usage
24
+ press ctrl + r to reset the max and peak record
23
25
 
24
26
  A Python-based `nvtop`-inspired command line tool for Apple Silicon (aka M1) Macs.
25
27
 
@@ -9,7 +9,7 @@ import psutil
9
9
  import plistlib
10
10
  import curses
11
11
 
12
- version = 'macpm v0.22'
12
+ version = 'macpm v0.24'
13
13
  parser = argparse.ArgumentParser(
14
14
  description=f'{version}: Performance monitoring CLI tool for Apple Silicon')
15
15
  parser.add_argument('--interval', type=int, default=1,
@@ -253,7 +253,11 @@ def parse_cpu_metrics(powermetrics_parse):
253
253
  core = e_core if name[0] == 'E' else p_core
254
254
  core.append(cpu["cpu"])
255
255
  cpu_metric_dict[name + str(cpu["cpu"]) + "_freq_Mhz"] = int(cpu["freq_hz"] / (1e6))
256
- idle_ratio = cluster["down_ratio"] + (1 - cluster["down_ratio"]) * (cpu["idle_ratio"] + cpu["down_ratio"])
256
+ #there is no down_ratio in M1
257
+ if cluster.get("down_ratio") is None:
258
+ idle_ratio = cpu["idle_ratio"]
259
+ else:
260
+ idle_ratio = cluster["down_ratio"] + (1 - cluster["down_ratio"]) * (cpu["idle_ratio"] + cpu["down_ratio"])
257
261
  cpu_metric_dict[name + str(cpu["cpu"]) + "_active"] = int((1 - idle_ratio) * 100)
258
262
  if name[0] == 'E':
259
263
  e_total_idle_ratio += idle_ratio
@@ -312,20 +316,20 @@ def parse_gpu_metrics(powermetrics_parse):
312
316
  return gpu_metrics_dict
313
317
 
314
318
  def parse_disk_metrics(powermetrics_parse):
315
- disk_metrics = powermetrics_parse["disk"]
319
+ disk_metrics = powermetrics_parse.get("disk",{})
316
320
  disk_metrics_dict = {
317
- "read_iops": int(disk_metrics["rops_per_s"]),
318
- "write_iops": int(disk_metrics["wops_per_s"]),
319
- "read_Bps": int(disk_metrics["rbytes_per_s"]),
320
- "write_Bps": int(disk_metrics["wbytes_per_s"]),
321
+ "read_iops": int(disk_metrics.get("rops_per_s",0)),
322
+ "write_iops": int(disk_metrics.get("wops_per_s",0)),
323
+ "read_Bps": int(disk_metrics.get("rbytes_per_s",0)),
324
+ "write_Bps": int(disk_metrics.get("wbytes_per_s",0)),
321
325
  }
322
326
  return disk_metrics_dict
323
327
 
324
328
  def parse_network_metrics(powermetrics_parse):
325
- network_metrics = powermetrics_parse["network"]
329
+ network_metrics = powermetrics_parse.get("network",{})
326
330
  network_metrics_dict = {
327
- "out_Bps": int(network_metrics["obyte_rate"]),
328
- "in_Bps": int(network_metrics["ibyte_rate"]),
331
+ "out_Bps": int(network_metrics.get("obyte_rate",0)),
332
+ "in_Bps": int(network_metrics.get("ibyte_rate",0)),
329
333
  }
330
334
  return network_metrics_dict
331
335
 
@@ -901,6 +905,9 @@ def begin(stdscr):
901
905
  view1.construct(soc_info_dict,args)
902
906
  view = 2
903
907
  clear_console()
908
+ elif key == 0x12:
909
+ #press ctrl+r to reset max and peak values
910
+ view1.__init__(soc_info_dict,args)
904
911
 
905
912
  if view == 1 or view == 2:
906
913
  view1.display(powermetrics_parse,args)
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.1
2
+ Name: macpm
3
+ Version: 0.24
4
+ Summary: Performance monitoring CLI tool for Apple Silicon
5
+ Home-page: https://github.com/visualcjy/macpm
6
+ Author: Jinyu Chen
7
+ Author-email: visualcjy@mail.com
8
+ License: MIT
9
+ Keywords: macpm
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: MacOS
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: dashing
16
+ Requires-Dist: psutil
17
+ Requires-Dist: humanize
18
+
19
+ # macpm
20
+
21
+ PyPI - Downloads (https://pypi.org/project/macpm/#files)
22
+ or: pip install macpm
23
+
24
+ enhanced MAC Performance monitoring CLI tool for Apple Silicon
25
+
26
+ ![](images/macpm-v.gif)
27
+ ![](images/macpm.gif)
28
+ ```shell
29
+ pip install macpm
30
+ ```
31
+
32
+ ## What is `macpm`
33
+
34
+ forked form https://github.com/tlkh/asitop
35
+ 1. fixed the problem that "E-CPU Usage" and "P-CPU Usage" always 100%
36
+ 2. add "Disk IO" and "Network IO" info
37
+ 3. adjust the hard coded max power in CPU/GPU/ANE
38
+ 4. change the way to call powermetrics, no temp files in /tmp
39
+ 5. press ESC or q to quit
40
+ 6. press LEFT or RIGHT to switch color, press 1 : default view, 2 : show_core view
41
+ 7. fix M1 has no "down_ratio" tag problem, fix p-core cpu usage
42
+ press ctrl + r to reset the max and peak record
43
+
44
+ A Python-based `nvtop`-inspired command line tool for Apple Silicon (aka M1) Macs.
45
+
46
+ * Utilization info:
47
+ * CPU (E-cluster and P-cluster), GPU
48
+ * Frequency and utilization
49
+ * ANE utilization (measured by power)
50
+ * Memory info:
51
+ * RAM and swap, size and usage
52
+ * (Apple removed memory bandwidth from `powermetrics`)
53
+ * Power info:
54
+ * CPU power, GPU power (Apple removed package power from `powermetrics`)
55
+ * Chart for CPU/GPU power
56
+ * Peak power, rolling average display
57
+
58
+ `macpm` uses the built-in [`powermetrics`](https://www.unix.com/man-page/osx/1/powermetrics/) utility on macOS, which allows access to a variety of hardware performance counters. Note that it requires `sudo` to run due to `powermetrics` needing root access to run. `macpm` is lightweight and has minimal performance impact.
59
+
60
+ **`macpm` only works on Apple Silicon Macs on macOS Monterey!**
61
+
62
+ ## Installation and Usage
63
+
64
+ `macpm` is a Python-based command line tool. You need `pip` to download and install `macpm`. macOS already comes with Python, to install `pip`, you can follow an [online guide](https://phoenixnap.com/kb/install-pip-mac). After you install `macpm` via `pip`, you can use it via the Terminal.
65
+
66
+ ```shell
67
+ # to enter password before start
68
+ # this mode is recommended!
69
+ sudo macpm
70
+
71
+ # it will prompt password on start
72
+ macpm
73
+
74
+ # advanced options
75
+ macpm [-h] [--interval INTERVAL] [--color COLOR] [--avg AVG]
76
+ optional arguments:
77
+ -h, --help show this help message and exit
78
+ --interval INTERVAL Display interval and sampling interval for powermetrics (seconds)
79
+ --color COLOR Choose display color (0~8)
80
+ --avg AVG Interval for averaged values (seconds)
81
+ ```
82
+
83
+ ## How it works
84
+
85
+ `powermetrics` is used to measure the following:
86
+
87
+ * CPU/GPU utilization via active residency
88
+ * CPU/GPU frequency
89
+ * Package/CPU/GPU/ANE energy consumption
90
+ * CPU/GPU/Media Total memory bandwidth via the DCS (DRAM Command Scheduler)
91
+
92
+ [`psutil`](https://github.com/giampaolo/psutil) is used to measure the following:
93
+
94
+ * memory and swap usage
95
+
96
+ [`sysctl`](https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/sysctl.3.html) is used to measure the following:
97
+
98
+ * CPU name
99
+ * CPU core counts
100
+
101
+ [`system_profiler`](https://ss64.com/osx/system_profiler.html) is used to measure the following:
102
+
103
+ * GPU core count
104
+
105
+ Some information is guesstimate and hardcoded as there doesn't seem to be a official source for it on the system:
106
+
107
+ * CPU/GPU TDP
108
+ * CPU/GPU maximum memory bandwidth
109
+ * ANE max power
110
+ * Media engine max bandwidth
111
+
112
+ ## Why
113
+
114
+ Because I didn't find something like this online. Also, just curious about stuff.
115
+
116
+ ## Disclaimers
117
+
118
+ I did this randomly don't blame me if it fried your new MacBook or something.
@@ -4,12 +4,12 @@ long_description = 'Performance monitoring CLI tool for Apple Silicon'
4
4
 
5
5
  setup(
6
6
  name='macpm',
7
- version='0.22',
7
+ version='0.24',
8
8
  author='Jinyu Chen',
9
9
  author_email='visualcjy@mail.com',
10
10
  url='https://github.com/visualcjy/macpm',
11
11
  description='Performance monitoring CLI tool for Apple Silicon',
12
- long_description=long_description,
12
+ long_description=open('README.md').read(),
13
13
  long_description_content_type="text/markdown",
14
14
  license='MIT',
15
15
  packages=find_packages(),
@@ -31,3 +31,9 @@ setup(
31
31
  ],
32
32
  zip_safe=False
33
33
  )
34
+
35
+ release_notes_0_2_3 = """
36
+ - ix M1 has no "down_ratio" tag problem
37
+ - fix p-core cpu usage。
38
+ """
39
+
macpm-0.22/PKG-INFO DELETED
@@ -1,19 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: macpm
3
- Version: 0.22
4
- Summary: Performance monitoring CLI tool for Apple Silicon
5
- Home-page: https://github.com/visualcjy/macpm
6
- Author: Jinyu Chen
7
- Author-email: visualcjy@mail.com
8
- License: MIT
9
- Keywords: macpm
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: MacOS
13
- Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: dashing
16
- Requires-Dist: psutil
17
- Requires-Dist: humanize
18
-
19
- Performance monitoring CLI tool for Apple Silicon
@@ -1,19 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: macpm
3
- Version: 0.22
4
- Summary: Performance monitoring CLI tool for Apple Silicon
5
- Home-page: https://github.com/visualcjy/macpm
6
- Author: Jinyu Chen
7
- Author-email: visualcjy@mail.com
8
- License: MIT
9
- Keywords: macpm
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: MacOS
13
- Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: dashing
16
- Requires-Dist: psutil
17
- Requires-Dist: humanize
18
-
19
- Performance monitoring CLI tool for Apple Silicon
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes