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 Monitoring

================================================================================
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

Metric             |     P50 |     P95
-----------------------------------------
GPU Power          | 11.70W  | 13.20W
CPU Power          |  1.00W  |  1.50W
GPU Utilization    |    32%  |    45%
GPU VRAM           |  8.20GB |  8.50GB
CPU Utilization    |    15%  |    22%
RAM Usage          | 16.30GB | 16.70GB
GPU Temperature    |    45°C |    48°C

Battery: 85.0% → 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.3.tar.gz (13.1 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.3-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: laperf_power-0.1.3.tar.gz
  • Upload date:
  • Size: 13.1 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.3.tar.gz
Algorithm Hash digest
SHA256 af21cb6c176c448901adae2639310cd9f45c9f0791c5124fc1919371a29d9f88
MD5 3ba975195b1b98bc29d927aa2887b5dd
BLAKE2b-256 2416e3c98e146fb634a6a4d993598eecb56f5e262b553ae2ced665b6c18287d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for laperf_power-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: laperf_power-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.8 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c6f4d622622d08b678333af9ab888d7fbc43b49e9e2839a89d967f55f6e54237
MD5 57b1895309bad04b5d39e164b0242a3c
BLAKE2b-256 3bb95173d1c042278d839564f4dbb07b1a4b62f9556d2f5a66e8434ea9af4e91

See more details on using hashes here.

Provenance

The following attestation bundles were made for laperf_power-0.1.3-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