A package to fetch GPU stats on macOS using powermetrics
Project description
macgputils
macgputils is a lightweight Python utility to fetch GPU statistics on macOS using the native powermetrics tool. It provides programmatic access to GPU power usage, frequency, active/idle time, and more.
Features
- Read real-time GPU power consumption (in mW)
- Get GPU hardware active frequency
- Check GPU idle residency
- Sample multiple times to monitor changes over time
- Easy-to-use API:
macgputils.get_gpu_stats()
Installation
pip install macgputils
If
powermetricsis not already available,macgputilswill prompt and help install it via Apple's developer tools.
Usage
import macgputils
# Get single sample
stats = macgputils.get_gpu_stats()
print(stats)
# Get multiple samples
for sample in macgputils.get_gpu_stats(samples=3):
print(sample)
Output Example
{'Active Frequency': '389 MHz', 'HW Active Residency': '14.00%', 'Idle Residency': '86.00%', 'GPU Power': '33 mW'}
API Reference
macgputils.get_gpu_stats(samples=1, interval=5)
| Parameter | Description |
|---|---|
samples |
Number of GPU usage samples to collect |
interval |
Time in seconds between each sample |
Returns:
- A dictionary if
samples=1 - A list of dictionaries if
samples > 1
Requirements
- macOS
- Python 3.6+
powermetrics(part of macOS; auto-installable via Xcode command line tools)
License
MIT License
Author
Developed by [Your Name]. Contributions are welcome — feel free to fork and submit pull requests!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file macgputils-0.1.tar.gz.
File metadata
- Download URL: macgputils-0.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f22efc1500d8377e1bafc25bd952885b3f0f82cb303d1af45ab5c3ff0e12304
|
|
| MD5 |
c77f8bd4151b0a0a4b5d6c40eb347000
|
|
| BLAKE2b-256 |
c0dea8af5c6690dcde99fcbc0d22a262b7581163500566c89cb71cc69bfa1248
|
File details
Details for the file macgputils-0.1-py3-none-any.whl.
File metadata
- Download URL: macgputils-0.1-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
163a953ec2ee65c8791056bacc475f077229bb011e996704d4bf3c3e0bbbfbb1
|
|
| MD5 |
35e09f6b820c4fe16ee017721f01c68a
|
|
| BLAKE2b-256 |
912de1863caabc54f7d8d7a5957a02762c4ea5a569af8b45e9d10dece4a12c65
|