Skip to main content

CLI tool to log Apple Silicon system metrics to terminal and/or CSV

Project description

asitop-csv

Because sometimes you want your Apple Silicon metrics in spreadsheet form, not just pretty terminal colors.

A CSV-logging fork of the excellent asitop - a Python-based nvtop-inspired command line tool for Apple Silicon Macs. While the original asitop gives you beautiful real-time terminal output, this fork saves all that juicy performance data to CSV files for easy analysis with pandas, Excel, or your favorite data visualization tools.

What's Different?

Instead of just displaying metrics in your terminal (though it still does that), this fork logs everything to CSV files so you can:

  • Create custom visualizations with matplotlib/seaborn
  • Perform deep analysis with pandas
  • Build dashboards in Jupyter notebooks
  • Track performance trends over time
  • Generate reports for system optimization

Perfect for developers, researchers, and data nerds who want to understand their Apple Silicon performance patterns beyond the moment.

Features

All the goodness of the original asitop, plus CSV logging:

Utilization Metrics (Now in CSV!)

  • CPU utilization (E-cluster and P-cluster)
  • GPU utilization and frequency
  • ANE (Apple Neural Engine) utilization
  • All timestamped for trend analysis

Memory Metrics (Spreadsheet Ready)

  • RAM and swap usage over time
  • Memory pressure indicators
  • Perfect for identifying memory bottlenecks

Power Metrics (Chart-Friendly)

  • CPU and GPU power consumption
  • Peak power tracking
  • Rolling averages for smooth trend lines
  • Great for battery life optimization studies

Installation

Same as the original - you'll need pip and Python (which macOS already has):

pip install asitop-csv
# or if you're installing from source
pip install -e .

Usage

Basic CSV Logging

# Start logging to CSV (recommended - enter password upfront)
sudo asitop-csv

# Or let it prompt for password
asitop-csv

Advanced Options

asitop-csv [-h] [--interval INTERVAL] [--color COLOR] [--avg AVG] [--output OUTPUT] [--no-display]

optional arguments:
  -h, --help            show this help message and exit
  --interval INTERVAL   Display interval and sampling interval (seconds, default: 1)
  --color COLOR         Choose display color (0~8, default: 2)
  --avg AVG            Interval for averaged values (seconds, default: 30)
  --output OUTPUT      CSV output directory (default: ./asitop_logs/)
  --no-display        Disable terminal output, CSV logging only

Pro Tips

Long-term monitoring:

# Run in background, log every 5 seconds, no terminal spam
sudo asitop-csv --interval 5 --no-display --output ~/Desktop/my_mac_stats/

Benchmark session:

# High-frequency logging during testing
sudo asitop-csv --interval 0.5 --output ./benchmark_$(date +%Y%m%d_%H%M%S)/

CSV Output Format

Your data gets saved in timestamped CSV files:

asitop_logs/
├── asitop_20241216_143022.csv
├── asitop_20241216_150315.csv
└── ...

Each CSV contains columns like:

  • timestamp - When the measurement was taken
  • cpu_util_total - Overall CPU utilization %
  • cpu_util_ecores - Efficiency cores utilization %
  • cpu_util_pcores - Performance cores utilization %
  • gpu_util - GPU utilization %
  • cpu_power - CPU power consumption (W)
  • gpu_power - GPU power consumption (W)
  • memory_used - RAM usage (GB)
  • memory_pressure - Memory pressure indicator
  • And much more...

Quick Analysis with Pandas

This fork includes built-in pandas integration for easy visualization and analysis:

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv("asitop_metrics.csv")
df['timestamp'] = pd.to_datetime(df['timestamp'])
sns.set(style="whitegrid")
metrics_to_plot = [
    "E-CPU Usage (%)", "P-CPU Usage (%)",
    "GPU Usage (%)", "RAM Used (GB)", "Swap Used (GB)",
    "CPU Power (W)", "GPU Power (W)", "Package Power (W)",
    "E-CPU Freq (MHz)", "P-CPU Freq (MHz)", "GPU Freq (MHz)"
]
for col in metrics_to_plot:
    plt.figure(figsize=(12, 4))
    sns.lineplot(data=df, x="timestamp", y=col)
    plt.title(col + " Over Time")
    plt.xlabel("Timestamp")
    plt.ylabel(col)
    plt.xticks(rotation=45)
    plt.tight_layout()
    plt.savefig(f"{col.replace(' ', '_').replace('(', '').replace(')', '')}.png")
    plt.close()
    
print(" graphs saved as ")

The tool automatically generates several common visualizations using pandas and matplotlib, including:

  • CPU and GPU utilization trends
  • Power consumption patterns
  • Memory usage over time
  • Temperature correlations
  • Performance efficiency metrics

How It Works

Same underlying tech as the original asitop:

  • powermetrics for CPU/GPU/ANE metrics (requires sudo)
  • psutil for memory and swap stats
  • sysctl for system information
  • system_profiler for hardware details

Plus: Custom CSV writer that timestamps and saves all metrics without impacting performance.

Why This Fork?

The original asitop is fantastic for real-time monitoring, but sometimes you need the data for:

  • Performance regression analysis
  • Battery optimization studies
  • Workload characterization
  • Custom dashboard creation
  • Academic research
  • Debugging performance issues

This fork gives you the best of both worlds - live monitoring AND historical data analysis.

Requirements

  • Apple Silicon Mac (M1, M1 Pro, M1 Max, M1 Ultra, M2, M2 Pro, M2 Max, etc.)
  • macOS Monterey or later
  • Python 3.6+
  • sudo access (because powermetrics needs it)

Contributing

Found a bug? Want to add a feature? PRs welcome! This is a community-driven fork focused on making Apple Silicon performance data more accessible for analysis.

License

Same as the original asitop - because we're standing on the shoulders of giants.

Credits

Huge thanks to @tlkh for creating the original asitop. This fork simply adds CSV logging capabilities to their excellent work.

Disclaimers

Just like the original: "I did this randomly don't blame me if it fried your new MacBook or something."

But seriously, this tool only reads performance metrics - it doesn't change any system settings. The biggest risk is filling up your disk with CSV files if you forget to stop it.


Happy monitoring! May your CPU temps be low and your GPU utilization be high.

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

asitop_csv_logger-1.0.7.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

asitop_csv_logger-1.0.7-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file asitop_csv_logger-1.0.7.tar.gz.

File metadata

  • Download URL: asitop_csv_logger-1.0.7.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for asitop_csv_logger-1.0.7.tar.gz
Algorithm Hash digest
SHA256 39b6513e8da893a34eb091c75a9491e8341b743371a69f10babdf059689e60d4
MD5 cb7b332c016d4968eb7ff51555fd011f
BLAKE2b-256 fe4a9869a34878f8f93b3ad3a6b3a5e15bd87f471e74aafd1139628bb79fe205

See more details on using hashes here.

File details

Details for the file asitop_csv_logger-1.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for asitop_csv_logger-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 77d3153313c3c432f484750743a8f01624035b273b54f37a51da400ffd4afe9f
MD5 06394bb507ce05b5d2cd72549c1c055b
BLAKE2b-256 ef1e6f9f7a60fa3e7d396ea199d7ba132782c2a9093d5c690147c983e7c1b481

See more details on using hashes here.

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