E607
Skip to content

sderosiaux/powermetrics-tui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

48 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ PowerMetrics TUI

Go Version Platform License Status

A beautiful, real-time system monitoring dashboard for macOS

Features โ€ข Installation โ€ข Usage โ€ข Screenshots โ€ข Contributing


๐ŸŽฏ Overview

PowerMetrics TUI transforms macOS's powerful powermetrics utility into an intuitive, interactive terminal dashboard. Monitor your system's performance, power consumption, and thermal state with a beautiful interface that makes complex metrics accessible to everyone.

Perfect for developers, power users, and anyone curious about their Mac's performance characteristics.

๐Ÿ“ธ Screenshots & Examples

Processes View with History Sparklines

TOP PROCESSES (142 active, 4 exited)

PID     Process                      CPU%    Memory      Disk      Network   CPU Hist   Mem Hist
12345   Xcode                        45.2%   2.3 GB      12 MB/s   0.5 MB/s  โ–ˆโ–ˆโ–ˆโ–ˆโ–‡โ–†โ–…โ–„   โ–…โ–…โ–…โ–…โ–…โ–…โ–…โ–…
23456   Chrome Helper (Renderer)     23.4%   892 MB      0 MB/s    2.1 MB/s  โ–ƒโ–„โ–…โ–†โ–‡โ–ˆโ–ˆโ–ˆ   โ–†โ–†โ–†โ–‡โ–‡โ–‡โ–‡โ–‡
34567   kernel_task                  18.9%   1.2 GB      34 MB/s   0 MB/s    โ–‚โ–ƒโ–„โ–…โ–„โ–ƒโ–‚โ–   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ
45678   Spotify                      12.3%   445 MB      0 MB/s    0.3 MB/s  โ–…โ–†โ–‡โ–†โ–…โ–„โ–ƒโ–„   โ–ƒโ–ƒโ–ƒโ–ƒโ–ƒโ–ƒโ–ƒโ–ƒ

RECENTLY EXITED PROCESSES (showing 4 of 4)
Process                                  Occurrences     Last Seen
swift build                                      3x        2m ago
clang++                                         5x        5m ago
node                                            2x        8m ago
python3                                         1x       12m ago

CPU Interrupts - Per-Core Breakdown

CPU0 (E):  IPI:   234/s  Timer:   890/s  Total:  1124/s  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘  โ–ƒโ–„โ–…โ–†โ–‡โ–†โ–…โ–„โ–ƒโ–‚
CPU1 (E):  IPI:   156/s  Timer:   823/s  Total:   979/s  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘  โ–‚โ–ƒโ–„โ–…โ–„โ–ƒโ–‚โ–โ–‚โ–ƒ
CPU4 (P):  IPI:  1823/s  Timer:  1234/s  Total:  3057/s  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘  โ–‡โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‡โ–†โ–…โ–„  โš ๏ธ
CPU5 (P):  IPI:  2156/s  Timer:  1456/s  Total:  3612/s  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‡โ–†  ๐Ÿ”ด

Power & Thermal Monitoring

POWER CONSUMPTION                        THERMAL STATUS
CPU:     15.2W  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘  68%   Thermal Pressure: Fair โš ๏ธ
GPU:      4.9W  โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘  27%   CPU P-Core: 78.3ยฐC โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘ Warning
ANE:      0.3W  โ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   3%   GPU:        71.2ยฐC โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘ Elevated
DRAM:     1.8W  โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘  10%   Fan: 4200 RPM (65% max)

โœจ Features

๐Ÿ“Š Comprehensive Monitoring

  • Per-CPU Interrupt Breakdown: See IPI, Timer, and Total interrupts for each individual CPU core with historical sparklines
  • Dynamic CPU Frequency Scaling: Real-time frequency monitoring for each E-core and P-core with auto-scaling graphs
  • GPU Frequency Monitoring: Persistent GPU frequency display with history sparkline (shows idle state)
  • Power Analytics: Monitor CPU, GPU, ANE (Neural Engine), and DRAM power consumption in real-time
  • Thermal Management: View temperature sensors and thermal pressure states (Nominal, Fair, Serious, Critical)
  • Battery Intelligence: Track charge levels with fixed-range sparkline (0-100%) for accurate visualization
  • Process Insights:
    • Top processes by CPU usage with individual sparklines showing historical trends
    • Recently Exited Processes: Track processes that have terminated in the last 5 minutes
    • Shows max CPU%, average CPU%, peak memory usage, and how long ago the process exited
    • Perfect for monitoring build tools, scripts, and temporary processes
  • I/O Statistics: Monitor network (in/out MB/s) and disk (read/write MB/s) activity with live graphs
  • Memory Usage: Track RAM and swap utilization with pressure indicators

๐ŸŽจ Beautiful Interface

  • 10 Specialized Views: Each metric category has its own optimized display
  • Real-time Visualizations:
    • Live-updating bar charts that auto-scale to your hardware's capabilities
    • Sparkline graphs showing trends for the last 30-120 samples
    • Per-process CPU and memory history sparklines
    • Per-core frequency history visualization
  • Smart Color Coding:
    • ๐Ÿ”ด Red: Critical/High usage (>80% CPU, >2000 interrupts/s, >50% power)
    • ๐ŸŸก Yellow: Moderate usage (50-80% CPU, 1000-2000 interrupts/s)
    • ๐ŸŸข Green: Normal usage (<50% CPU, <1000 interrupts/s)
    • ๐Ÿ”ต Blue: Efficiency cores, network input, memory usage
  • Responsive Design: Automatically adjusts to terminal size, showing more processes on larger screens

๐Ÿค User-Friendly

  • Help System: Built-in descriptions for technical terms (toggle with 'h')
  • Quick Navigation:
    • Number keys (1-9, 0) for instant view switching
    • Tab/Shift+Tab or Arrow keys for sequential navigation
  • Cross-Architecture:
    • Apple Silicon: Distinguishes E-cores (Efficiency) and P-cores (Performance)
    • Intel Macs: Shows all CPU cores with appropriate frequency ranges
  • Auto-Detection: Intelligently adapts to your Mac's capabilities and maximum frequencies

๐Ÿ“ฅ Installation

Prerequisites

  • macOS (any version with powermetrics utility)
  • Go 1.21 or later
  • Terminal with UTF-8 support

Quick Install

# Clone the repository
git clone https://github.com/sderosiaux/powermetrics-tui.git
cd powermetrics-tui

# Build the application
go build -o powermetrics-tui

# Make it globally accessible (optional)
sudo cp powermetrics-tui /usr/local/bin/

Install from Source

go install github.com/sderosiaux/powermetrics-tui@latest

๐Ÿš€ Usage

Quick Start

# Authenticate sudo (required for powermetrics)
sudo -v

# Launch with all metrics
powermetrics-tui

# Or specify specific metrics
powermetrics-tui --samplers cpu_power,gpu_power,thermal

Navigation

Key Action
1-9, 0 Jump directly to specific views
Tab Cycle through views
h or ? Toggle help descriptions
q Quit application

Available Views

  1. Interrupts - CPU interrupt statistics with per-core IPI/Timer breakdown
  2. Power - Power consumption metrics (CPU/GPU/ANE/DRAM)
  3. Frequency - CPU/GPU clock speeds with historical sparklines
  4. Processes - Top processes with CPU/memory history sparklines
  5. Network - Network I/O statistics with throughput graphs
  6. Disk - Disk I/O statistics with read/write monitoring
  7. Thermal - Temperature and thermal pressure monitoring
  8. Battery - Battery status, health, and charging metrics
  9. System - Overall system metrics and resource usage
  10. Combined - All metrics in one comprehensive view

Command-Line Options

powermetrics-tui [options]

Options:
  --samplers    Comma-separated list of samplers (default: all)
                Options: interrupts, cpu_power, gpu_power, thermal, battery
  --interval    Sampling interval in milliseconds (default: 1000)
  --combined    Start in combined view mode
  --debug       Enable debug output

Usage Scenarios

๐Ÿ”ฅ Performance Troubleshooting

# Monitor CPU throttling under load
powermetrics-tui --samplers cpu_power,thermal,frequency

# Watch for thermal throttling during intensive tasks
# View shows: Thermal Pressure (Nominal โ†’ Fair โ†’ Serious โ†’ Critical)
# CPU frequencies will drop when thermal limits are reached

๐Ÿ”‹ Battery Optimization

# Track power consumption while on battery
powermetrics-tui --samplers battery,cpu_power,gpu_power

# Identify power-hungry processes
# Switch to Processes view (4) to see CPU% with historical trends
# High CPU sparklines (โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ) indicate consistent high usage

๐ŸŽฎ Gaming/Graphics Performance

# Monitor GPU and CPU performance during gaming
powermetrics-tui --samplers gpu_power,frequency,thermal

# GPU power spikes indicate graphics-intensive operations
# P-core frequencies show performance core utilization
# Thermal view reveals if throttling is affecting FPS

๐Ÿ’ป Development Workflow

# Monitor system impact during builds/compilation
powermetrics-tui --interval 500  # Faster sampling for quick changes

# Example during Xcode build:
# - E-cores: 2100-2400 MHz (background indexing)
# - P-cores: 3800-4200 MHz (active compilation)
# - Power: 15-25W CPU, 5-10W GPU
# - Processes: clang/swift showing high CPU% with rising sparklines

๐Ÿ” System Debugging

# Investigate high interrupt rates (kernel issues)
powermetrics-tui

# Switch to Interrupts view (1)
# Look for:
# - IPI > 2000/s per CPU (red) indicates excessive inter-core communication
# - Timer > 1500/s (yellow) suggests timer coalescing issues
# - Uneven distribution across cores points to IRQ affinity problems

๐Ÿ› ๏ธ Technical Details

Architecture Support

  • Apple Silicon: Full support for M1, M2, M3 series

    • Efficiency cores (E-cores) and Performance cores (P-cores) tracking
    • ANE (Apple Neural Engine) power monitoring
    • Unified memory architecture metrics
  • Intel Macs: Complete compatibility

    • Traditional CPU frequency scaling
    • Turbo Boost monitoring
    • Discrete GPU tracking (if available)

Data Sources

PowerMetrics TUI leverages macOS's native powermetrics utility, providing:

  • Hardware-level accuracy
  • Minimal performance overhead
  • Real-time sampling capabilities
  • Access to exclusive Apple Silicon metrics

๐Ÿค Contributing

Contributions are welcome! Whether it's:

  • ๐Ÿ› Bug reports
  • ๐Ÿ’ก Feature suggestions
  • ๐Ÿ“– Documentation improvements
  • ๐Ÿ”ง Code contributions

Please feel free to:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with tcell - Excellent terminal UI library for Go
  • Powered by macOS powermetrics - Apple's powerful system monitoring utility
  • Inspired by tools like htop, btop, and vtop

๐Ÿ”— Links


Made with โค๏ธ for the macOS community

Releases

No releases published

Packages

 
 
 

Contributors

0