Skip to content

op06072/NeoAsitop

Repository files navigation

neoasitop

A sudoless performance monitoring CLI tool for Apple Silicon

Stars

Introducing

What is neoasitop

A Swift-based asitop-inspired command line tool for Apple Silicon (aka M series) Macs.

neoasitop uses the custom socpowerbuddy-inspired logic, which allows access to a variety of hardware performance counters without sudo permission. neoasitop is lightweight and has minimal performance impact.

neoasitop officially tested on following Apple Silicon Macs!

  • Test list
    • 2021 MacBook Pro[MacBookPro18,1] (M1 Pro, Ventura)
    • 2022 Mac Studio[Mac13,2] (M1 Ultra, Ventura)
    • 2020 Mac mini[Macmini9,1] (M1, Monterey)
    • 2020 MacBook Air[MacBookAir10,1] (M1, Monterey)

Why

Because I didn't want to be the system admin just to see the status of the system. Why kill a fly with a spear? Admin privileges are too powerful to just monitor the system.

How it works

socpowerbuddy-inspired custom logic is used to measure the following:

  • CPU/GPU utilization via active residency
  • CPU/GPU frequency
  • CPU/GPU/ANE/DRAM energy consumption
  • CPU/GPU/Media Total memory bandwidth via the DCS (DRAM Command Scheduler)
  • CPU/GPU core count

stats-inspired custom logic is used to measure the following:

  • CPU/GPU/Airflow temperature
  • Fan speed
  • System energy consumption
  • OS Version

sysctl is used to measure the following:

  • CPU name
  • CPU core counts
  • Fan existence
  • memory and swap usage

Hot is used to measure the following:

  • SOC Throttling

Some information is guesstimated and hardcoded as there doesn't seem to be a official source for it on the system:

  • CPU/GPU TDP
  • CPU/GPU maximum memory bandwidth
  • ANE max power
  • Media engine max bandwidth

Feature

  • Utilization info:
    • CPU (E-cluster and P-cluster), GPU
    • Frequency and utilization, temperature
    • ANE utilization (measured by power)
    • Fan speed (if fan exists)
    • SOC throttling
  • Memory info:
    • RAM and swap, size and usage
    • Memory bandwidth (CPU/GPU/total)
    • Media engine bandwidth usage
  • Power info:
    • System power, CPU power, GPU power, DRAM power
    • Chart for CPU/GPU power
    • Peak power, rolling average display

Installation, Usage, and Making

Note: Tool usage is listed by neoasitop --help

# advanced options
USAGE: neoasitop [--version] [--verbose] [--test] [--interval <interval>] [--color <color>] [--avg <avg>] [--dump <dump>]

OPTIONS:
  -v, --version           Print version information
  --verbose               Show detail information of this system like OS codename, CPU architecture name, etc.
  -t, --test              Test the features with dumped file from iorepdump.
  -i, --interval <interval>
                          Display interval and sampling interval for info gathering (seconds) [0.01~] (default: 1.0)
  -c, --color <color>     Choose display color (0~7) (default: 2)
  --avg <avg>             Interval for averaged values (seconds) (default: 30.0)
  -d, --dump <dump>       Path of the dumped file.
  -h, --help              Show help information.

color

Color Code Color note
0 black Light mode
1 red
2 green Default
3 yellow
4 blue
5 magenta
6 cyan
7 white

Install using Homebrew

  1. If you dont have Hombrew, install it!
  2. Add my tap using brew tap op06072/neoasitop
  3. Install the tool with brew install neoasitop
  4. Run neoasitop!

Install Manually

  1. Download the bin from latest release.
  2. Unzip the downloaded file into your desired dir (such as /usr/bin)
  3. Run neoasitop!

Building the project

The source is bundled in a Xcode project. Simply build via Xcode on your mac!

Diagnosing missing entries for your system

A diagnostic dumping tool is included within each release: iorepdump. It dumps all IOReport groups matching those used by NeoAsitop. It's helpful for discovering entries on new silicon.

Credits

Special thanks to:

  • tlkh for the project asitop that inspired me to start this project.
  • BitesPotatoBacks for the project SocPowerBuddy that gave me the way to replace powermetrics.
  • exelban for the project stats that gave me the way to get sensor value.
  • macmade for the project Hot that gave me the way to get soc throttle status.
  • rderik for the project clock that gave me the way to use ncurses in swift.

Dislaimers

As I said, some information is just guesstimated. So don't blame me if it fried your new MacBook or something. Well...I don't think that's going to happen.