Apple Silicon 'top' CLI

Related tags

CLI Tools asitop
Overview

asitop

pip install asitop

What

A nvtop/htop style/inspired command line tool for Apple Silicon (aka M1) Macs.

Note that it requires sudo to run due to powermetrics needing root access to run.

# it will prompt you for password on start
asitop

# to enter password before start
sudo asitop

Why

Because I didn't find something like this online.

Disclaimers

I did this in a few hours don't blame me if it fried your new MacBook or something.

Comments
  • Fix invalid parameter on powermetrics

    Fix invalid parameter on powermetrics

    I have an error running asitop, it tells that powermetrics got invalid parameter. I looked closer and find out that -u parameter should be passed instead of -o

    > powermetrics --help | grep output
        -u | --output-file <file>    output to file [default: stdout]
    

    I am running this on MacBook Air M1 and maybe you have different parameters so let me know if that's a valid fix.

    opened by paul-nameless 6
  • Error on Launch = 14

    Error on Launch = 14" MBP

    asitop

    [1/3] Loading ASITOP

    [2/3] Starting powermetrics process

    [3/3] Waiting for first reading...

    Password: Traceback (most recent call last): File "/Users/nat/Library/Python/3.8/lib/python/site-packages/asitop/utils.py", line 21, in parse_powermetrics bandwidth_metrics = parse_bandwidth_metrics(powermetrics_parse) File "/Users/nat/Library/Python/3.8/lib/python/site-packages/asitop/parsers.py", line 41, in parse_bandwidth_metrics bandwidth_metrics_dict["VENC1 DCS RD"] KeyError: 'VENC1 DCS RD'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/Users/nat/Library/Python/3.8/bin/asitop", line 8, in sys.exit(main()) File "/Users/nat/Library/Python/3.8/lib/python/site-packages/asitop/asitop.py", line 118, in main ready = get_reading() File "/Users/nat/Library/Python/3.8/lib/python/site-packages/asitop/asitop.py", line 115, in get_reading ready = parse_powermetrics(timecode=timecode) File "/Users/nat/Library/Python/3.8/lib/python/site-packages/asitop/utils.py", line 31, in parse_powermetrics bandwidth_metrics = parse_bandwidth_metrics(powermetrics_parse) File "/Users/nat/Library/Python/3.8/lib/python/site-packages/asitop/parsers.py", line 41, in parse_bandwidth_metrics bandwidth_metrics_dict["VENC1 DCS RD"] KeyError: 'VENC1 DCS RD'

    opened by itsthenat 5
  • KeyError: 'STRM CODEC DCS RD'

    KeyError: 'STRM CODEC DCS RD'

    Hi,

    thanks for your work on asitop. I am getting the following error on a MacBookPro17,1 (MacBook Pro (13-inch, M1, 2020)) running macOS 12.0.1.

    sudo asitop Password:

    [1/3] Loading ASITOP

    [2/3] Starting powermetrics process

    [3/3] Waiting for first reading...

    Traceback (most recent call last): File "/opt/homebrew/lib/python3.9/site-packages/asitop/utils.py", line 21, in parse_powermetrics bandwidth_metrics = parse_bandwidth_metrics(powermetrics_parse) File "/opt/homebrew/lib/python3.9/site-packages/asitop/parsers.py", line 47, in parse_bandwidth_metrics bandwidth_metrics_dict["STRM CODEC DCS RD"], bandwidth_metrics_dict["STRM CODEC DCS WR"], KeyError: 'STRM CODEC DCS RD'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/opt/homebrew/bin/asitop", line 8, in sys.exit(main()) File "/opt/homebrew/lib/python3.9/site-packages/asitop/asitop.py", line 118, in main ready = get_reading() File "/opt/homebrew/lib/python3.9/site-packages/asitop/asitop.py", line 115, in get_reading ready = parse_powermetrics(timecode=timecode) File "/opt/homebrew/lib/python3.9/site-packages/asitop/utils.py", line 31, in parse_powermetrics bandwidth_metrics = parse_bandwidth_metrics(powermetrics_parse) File "/opt/homebrew/lib/python3.9/site-packages/asitop/parsers.py", line 47, in parse_bandwidth_metrics bandwidth_metrics_dict["STRM CODEC DCS RD"], bandwidth_metrics_dict["STRM CODEC DCS WR"], KeyError: 'STRM CODEC DCS RD'

    Any suggestions? Thanks!

    opened by menzHSE 4
  • Not working on MBP11,3

    Not working on MBP11,3

    Hi, I'm getting an error when I try to start it

    Model: MBP11,3

    powermetrics: unrecognized sampler: bandwidth
    ^CTraceback (most recent call last):
      File "/usr/local/bin/asitop", line 8, in <module>
        sys.exit(main())
      File "/usr/local/lib/python3.9/site-packages/asitop/asitop.py", line 109, in main
        ready = get_reading()
      File "/usr/local/lib/python3.9/site-packages/asitop/asitop.py", line 105, in get_reading
        time.sleep(wait)
    
    opened by joshauh46 4
  • Check return code of powermetrics and throw excpetion accordingly

    Check return code of powermetrics and throw excpetion accordingly

    Check the return code of powermetrics process and throw exception if return code is non-zero.

    This happens "-u" vs "-o" arguments change and current exception handler does not handle return code.

    This patch fixes reported issue: powermetrics: unrecognized order: /tmp/asitop_powermetrics1638952131 #17 and also allows asitop to run on BigSur.

    opened by ardacoskunses 3
  • ANE not showing any usage on M1 Pro

    ANE not showing any usage on M1 Pro

    Hi,

    I have an M1 Pro, and I've been trying to get asitop to show ANE usage. However, even when executing ML based tasks, such as: https://github.com/asus4/depth-prediction-macOS

    The ANE usage is pegged to 0/0w.

    Any idea why?

    opened by johnalanwoods 3
  • KeyError: 'hw.perflevel1.logicalcpu'

    KeyError: 'hw.perflevel1.logicalcpu'

    Hello again,

    Thanks for merging the fix with powermetrics.

    Unfortunately now I am facing another error, maybe that's also because of the different OS versions... Here is a traceback:

    Traceback (most recent call last):
      File "/opt/homebrew/bin/asitop", line 8, in <module>
        sys.exit(main())
      File "/opt/homebrew/lib/python3.9/site-packages/asitop/asitop.py", line 71, in main
        soc_info_dict = get_soc_info()
      File "/opt/homebrew/lib/python3.9/site-packages/asitop/utils.py", line 136, in get_soc_info
        "e_core_count": core_counts_dict["hw.perflevel1.logicalcpu"],
    KeyError: 'hw.perflevel1.logicalcpu'
    

    core_counts_dict calls get_core_counts() and it calls sysctl -a | grep hw.perflevel which returns nothing on BigSur at least

    Here is the output that I could get:

    ~ > sudo sysctl -a | grep hw.p 
    hw.packages: 1
    hw.pagesize: 16384
    hw.pagesize32: 16384
    hw.physicalcpu: 8
    hw.physicalcpu_max: 8
    
    opened by paul-nameless 3
  • install issue with conda (resolved instruction)

    install issue with conda (resolved instruction)

    I use conda (installed via brew install miniforge) for the python installation and I created a new environment for the asitop along with latest version of python (3.10.2).

    After installing asitop via pip install asitop, I got following error message:

    Traceback (most recent call last):
      File "/opt/homebrew/Caskroom/miniforge/base/envs/asitop/bin/asitop", line 5, in <module>
        from asitop.asitop import main
      File "/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/asitop/asitop.py", line 6, in <module>
        from .utils import *
      File "/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/asitop/utils.py", line 5, in <module>
        import psutil
      File "/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/psutil/__init__.py", line 123, in <module>
        from . import _psosx as _psplatform
      File "/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/psutil/_psosx.py", line 14, in <module>
        from . import _psutil_osx as cext
    ImportError: dlopen(/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/psutil/_psutil_osx.cpython-310-darwin.so, 0x0002): tried: '/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/psutil/_psutil_osx.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
    

    Removing psutil and reinstalling seems to show that correct arch binary is installed:

    pip install psutil                                                                                                                              
    Collecting psutil
      Using cached psutil-5.9.1-cp310-cp310-macosx_11_0_arm64.whl
    Installing collected packages: psutil
    Successfully installed psutil-5.9.1
    

    But I still ended up with same error message.

    So I decided to build psutil locally: pip install --no-binary :all: psutil (from https://github.com/giampaolo/psutil/blob/master/INSTALL.rst and you need Xcode installed already)

    And it finally worked. Thanks for the awesome package.

    I'm creating the issue here in case someone else runs into the same issue.

    opened by neoswallow 2
  • M2 GPU clock speed

    M2 GPU clock speed

    I've been searching for the M2 GPU clock speed for quite a while. Sources cited by Wikipedia (specifically cpu-monkey) are extremely unreliable, and I'm trying to determine something important about the Apple8 microarchitecture. Compared to Apple7, Apple8 supposedly has double the ALUs. That would mean Apple nearly halved the clock speed.

    I have an A15 iPhone, but iOS can't run powermetrics for reverse-engineering. If any users could run asitop - or even just sudo powermetrics, that would help a lot. Just show the text of GPU clock speed range for M2. Thanks!

    opened by philipturner 1
  • Update TDP and bandwidth information for Apple M2

    Update TDP and bandwidth information for Apple M2

    The CPU power limit is set to 25 W. source (P-cores can consume 25 watts for the first few seconds)

    The GPU power limit is set to 15 W. source

    The memory bandwidth should be 100 GB/s. source

    I personally own a MacBook Air equipped with M2, and I am happy to validate the data above if there are proper/recommended ways to estimate the numbers :).

    opened by 6-6-6 0
  • add --max_count arguement to prevent large memory usage after a long time

    add --max_count arguement to prevent large memory usage after a long time

    As #6 mentioned, run asitop over a long time, a python progress would occupy large amount of memory. This pr add an option of '--max_count' to specify how many refresh times after to restart the powermetrics process.

    opened by buliaoyin 0
  • asitop command wont work after installation Ventura

    asitop command wont work after installation Ventura

    hey guys

    Ive been trying to get asitop to work but i get the following output, seems like some sort of PATH issue

    natsukirei@Lukes-Mac-Studio ~ % pip3 install git+https://github.com/SuperKenVery/asitop.git Defaulting to user installation because normal site-packages is not writeable Collecting git+https://github.com/SuperKenVery/asitop.git Cloning https://github.com/SuperKenVery/asitop.git to /private/var/folders/fy/3cg2scgs4q7dvt18hvnrf_bw0000gn/T/pip-req-build-24bp443w Running command git clone --filter=blob:none --quiet https://github.com/SuperKenVery/asitop.git /private/var/folders/fy/3cg2scgs4q7dvt18hvnrf_bw0000gn/T/pip-req-build-24bp443w Resolved https://github.com/SuperKenVery/asitop.git to commit 9a67ed7eebd95370d6b97fd9821b4ef1628ff613 Preparing metadata (setup.py) ... done Requirement already satisfied: dashing in ./Library/Python/3.9/lib/python/site-packages (from asitop==0.0.21) (0.1.0) Requirement already satisfied: psutil in ./Library/Python/3.9/lib/python/site-packages (from asitop==0.0.21) (5.9.4) Requirement already satisfied: blessed in ./Library/Python/3.9/lib/python/site-packages (from dashing->asitop==0.0.21) (1.19.1) Requirement already satisfied: six>=1.9.0 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (from blessed->dashing->asitop==0.0.21) (1.15.0) Requirement already satisfied: wcwidth>=0.1.4 in ./Library/Python/3.9/lib/python/site-packages (from blessed->dashing->asitop==0.0.21) (0.2.5) Building wheels for collected packages: asitop Building wheel for asitop (setup.py) ... done Created wheel for asitop: filename=asitop-0.0.21-py3-none-any.whl size=9180 sha256=4c74e00e58c4a58a940ed45e517e356aca90668d925ddb6fcfb869161f53accd Stored in directory: /private/var/folders/fy/3cg2scgs4q7dvt18hvnrf_bw0000gn/T/pip-ephem-wheel-cache-8cwteb4o/wheels/06/e0/2c/f097fa055ab84bb08a213e9e75f9ee496a4979ef98f897328a Successfully built asitop Installing collected packages: asitop WARNING: The script asitop is installed in '/Users/natsukirei/Library/Python/3.9/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed asitop-0.0.21 natsukirei@Lukes-Mac-Studio ~ % asitop zsh: command not found: asitop

    opened by natsukirei 3
  • [Q] CPU usage high in asitop while htop and Activity Monitor show around 9%

    [Q] CPU usage high in asitop while htop and Activity Monitor show around 9%

    Is this a bug, or are the metrics reported by asitop different from the percentages reported by these other tools?

    image image image

    PS: I am on macOS Ventura, using this fork:

    pip uninstall -y asitop
    pip install git+https://github.com/SuperKenVery/asitop.git
    
    opened by NightMachinery 0
  • high cpu usage from asitop/python process when running for extended duration

    high cpu usage from asitop/python process when running for extended duration

    I keep asitop running all the time on my 2021 16" MBP M1 Max Monterey 12.6.1. It seems that the longer it is left running the most CPU it consumes and after about 12hrs I find that it (python) is consuming 100% of a core according to top. Restarting asitop fixes the issues, but it of course reappears some hours later.

    opened by sfc-gh-mfalco 0
  • Support macOS 13

    Support macOS 13

    I changed the bandwidths to disk r/w and network i/o.

    I think those are more useful, and they avoided the problem that bandwiths are not available on macOS 13.

    opened by SuperKenVery 21
  • install asitop with poetry is not working

    install asitop with poetry is not working

    Can someone successfully install asitop package with poetry?

    I use poetry to install asitop package about 1 month ago, it work at that time.

    But when I reinstall asitop with poetry today, it stuck and no reaction.

    poetry version: 1.2.1 python version: 3.10.6

    opened by SMH642800 0
Owner
Timothy Liu
Deep Learning stuff and Open Source Enthusiast @OpenSUTD
Timothy Liu
flora-dev-cli (fd-cli) is command line interface software to interact with flora blockchain.

Install git clone https://github.com/Flora-Network/fd-cli.git cd fd-cli python3 -m venv venv source venv/bin/activate pip install -e . --extra-index-u

null 14 Sep 11, 2022
AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

Rafael Torres 2 Dec 10, 2021
Python-Stock-Info-CLI: Get stock info through CLI by passing stock ticker.

Python-Stock-Info-CLI Get stock info through CLI by passing stock ticker. Installation Use the following command to install the required modules at on

Ayush Soni 1 Nov 5, 2021
A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool

Privateer A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool How

Shreyash Chavan 2 Apr 4, 2022
Yts-cli-streamer - A CLI movie streaming client which works on yts.mx API written in python

YTSP It is a CLI movie streaming client which works on yts.mx API written in pyt

null 1 Feb 5, 2022
[WIP]An ani-cli like cli tool for movies and webseries

mov-cli A cli to browse and watch movies. Installation This project is a work in progress. However, you can try it out python git clone https://github

null 166 Dec 30, 2022
Bad Apple printed out on the console with Python!

Bad Apple printed out on the console with Python!

CalvinLoke 186 Dec 1, 2022
Python3 parser for Apple's crash reports

pyCrashReport in intended for analyzing crash reports from Apple devices into a clearer view, without all the thread listing and loaded images, just the actual data you really need to debug the problem ?? .

null 7 Aug 19, 2022
Dead simple CLI tool to try Python packages - It's never been easier! :package:

try - It's never been easier to try Python packages try is an easy-to-use cli tool to try out Python packages. Features Install specific package versi

Timo Furrer 659 Dec 28, 2022
CLI for SQLite Databases with auto-completion and syntax highlighting

litecli Docs A command-line client for SQLite databases that has auto-completion and syntax highlighting. Installation If you already know how to inst

dbcli 1.8k Dec 31, 2022
Postgres CLI with autocompletion and syntax highlighting

A REPL for Postgres This is a postgres client that does auto-completion and syntax highlighting. Home Page: http://pgcli.com MySQL Equivalent: http://

dbcli 10.8k Jan 2, 2023
A supercharged AWS command line interface (CLI).

SAWS Motivation AWS CLI Although the AWS CLI is a great resource to manage your AWS-powered services, it's tough to remember usage of: 70+ top-level c

Donne Martin 5.1k Jan 5, 2023
CLI program that allows you to change your Alacritty config with one command without editing the config file.

Pycritty Change your alacritty config on the fly! Installation: pip install pycritty By default, only the program itself will be installed, but you ca

Antonio Sarosi 184 Jan 7, 2023
QueraToCSV is a simple python CLI project to convert the Quera results file into CSV files.

Quera is an Iranian Learning management system (LMS) that has an online judge for programming languages. Some Iranian universities use it to automate the evaluation of programming assignments.

Amirmahdi Namjoo 16 Nov 11, 2022
Simple CLI tool to track your cryptocurrency portfolio in real time.

Simple tool to track your crypto portfolio in realtime. It can be used to track any coin on the BNB network, even obscure coins that are not listed or trackable by major portfolio tracking applications.

Trevor White 69 Oct 24, 2022
CLI utility to search and download torrents from major torrent sites

CLI Torrent Downloader About CLI Torrent Downloader provides convenient and quick way to search torrent magnet links (and to run associated torrent cl

x0r0x 86 Dec 19, 2022
Write Django management command using the click CLI library

Django Click Project information: Automated code metrics: django-click is a library to easily write Django management commands using the click command

Jonathan Stoppani 215 Dec 19, 2022