Skip to main content

Lightweight real-time power and resource monitoring tool for AI workloads

Project description

LaPerf Power

Lightweight real-time power and resource monitoring tool for AI/ML workloads.

Features

  • Real-time monitoring with live console output
  • Cross-platform support: macOS (Apple Silicon + Intel), Linux (NVIDIA), Windows
  • Comprehensive metrics: GPU/CPU power, utilization, VRAM, temperature, RAM, battery
  • Statistical analysis: P50/P95 percentiles for all metrics
  • JSON export for further analysis
  • Zero heavy dependencies: Only requires psutil (~5 MB installed)

Installation

Quick run without installation (recommended)

uvx laperf-power

Install as a global tool

# Using uv
uv tool install laperf-power

# Using pip
pip install laperf-power

Usage

# Start monitoring with default settings (10s interval)
laperf-power

# Custom sampling interval (faster sampling = more overhead)
laperf-power --interval 1.0

# Without sudo (basic metrics only on macOS)
laperf-power --no-sudo

# Save results to JSON
laperf-power --output power_metrics.json

Press Ctrl+C to stop and view statistics.

What It Monitors

GPU Metrics

  • Power consumption (Watts) - NVIDIA via nvidia-smi, macOS via powermetrics
  • Utilization (%) - GPU compute usage
  • VRAM (GB) - Memory used/total
  • Temperature (°C) - Die temperature

CPU Metrics

  • Power consumption (Watts) - macOS only with sudo
  • Utilization (%) - Average across all cores

System Metrics

  • RAM usage (GB) - Process memory consumption
  • Battery drain (%) - Change during monitoring period

Platform Support

Platform GPU Power GPU Stats CPU Power Notes
macOS (Apple Silicon) ✅ (with sudo) ✅ (with sudo) Via powermetrics and ioreg
macOS (Intel) ✅ (with sudo) Via powermetrics
Linux (NVIDIA) Via nvidia-smi
Linux (AMD/Intel) CPU/RAM only
Windows CPU/RAM only

Example Output

⚡ REAL-TIME POWER MONITORING
================================================================================
Started: 2025-11-27 14:30:00
Interval: 10.0s
================================================================================

Press Ctrl+C to stop and view statistics

[Sample #42] GPU: 11.7W 32% 8.2GB | CPU: 15% 1.0W | RAM: 16.3GB | Temp: 45°C

Final statistics:

📊 MONITORING SUMMARY
================================================================================

Duration: 420.0s
Samples collected: 42

🎮 GPU Power:
  P50: 11.7W
  P95: 13.2W

💻 CPU Power:
  P50: 1.0W
  P95: 1.5W

🎯 GPU Utilization:
  P50: 32%
  P95: 45%

💾 GPU VRAM:
  P50: 8.2GB
  P95: 8.5GB

🔧 CPU Utilization:
  P50: 15%
  P95: 22%

🧠 RAM Usage:
  P50: 16.3GB
  P95: 16.7GB

🔋 Battery:
  Start: 85.0% → End: 83.5%
  Drain: 1.5%

macOS sudo Setup (Optional)

For detailed GPU/CPU power metrics on macOS, laperf-power uses sudo powermetrics.

Option 1: Enter password when prompted (recommended for occasional use)

Option 2: Passwordless sudo (for frequent use)

Add to /etc/sudoers (use sudo visudo):

your_username ALL=(ALL) NOPASSWD: /usr/bin/powermetrics

Use Cases

  • AI/ML Development: Monitor power usage during model training/inference
  • Hardware Evaluation: Compare power efficiency across different GPUs
  • Performance Optimization: Identify power/performance bottlenecks
  • Battery Life Testing: Track power consumption on laptops
  • System Monitoring: Real-time resource usage dashboard

Part of LaPerf

laperf-power is extracted from LaPerf - a comprehensive AI hardware benchmark suite. For full benchmarking capabilities (embeddings, LLMs, VLMs), check out the main project.

License

Apache-2.0

Contributing

Issues and PRs welcome at https://github.com/bogdanminko/laperf

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

laperf_power-0.1.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

laperf_power-0.1.1-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file laperf_power-0.1.1.tar.gz.

File metadata

  • Download URL: laperf_power-0.1.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for laperf_power-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ee4aa4c19336a14a81aa56f10b3416c237ce62e5130d04d35cbd6dbc07131044
MD5 0d72c3c3ad0b3f12d7948b2606c81a4e
BLAKE2b-256 a6cecb4eab28378835221d52851433e4b3f0c625fcbfbba13d96901f7c5b32c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for laperf_power-0.1.1.tar.gz:

Publisher: publish-laperf-power.yml on bogdanminko/laperf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file laperf_power-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: laperf_power-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for laperf_power-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 659f1ea6ed606c9b6d589f168ceab325917e0638cad33c2b1f5c709fef8706e3
MD5 53f55333c89bf20edf16fd01073e7ee2
BLAKE2b-256 a1fe4345ceb110b9fc017f57d5b0acce7305b0cd933312a90e44de666fa78e19

See more details on using hashes here.

Provenance

The following attestation bundles were made for laperf_power-0.1.1-py3-none-any.whl:

Publisher: publish-laperf-power.yml on bogdanminko/laperf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page