Giter Site home page Giter Site logo

siliconlife / socpowerbud Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dehydratedpotato/socpowerbud

0.0 0.0 0.0 386 KB

Sudoless utility to profile current frequency, cycles, residency, etc for Apple Silicon

License: MIT License

Objective-C 99.46% Makefile 0.54%

socpowerbud's Introduction

socpowerbud Releases License Stars

Sudoless utility to profile current frequency, cycles, voltage, residency, and more on Apple Silicon!


Project Deets

Wat it do

SocPowerBuddy samples counter values from the IOReport and returns formatted results for various metrics! It's written in Objective-C because NS types made things easier, it could be better if I rewrote it in plain C (but I've got better projects to work on then to spend time on this one).

It is based on reverse engineering powermetrics, and reports every statistic offered by powermetrics -s cpu_power,gpu_power (see full metric list and example output), but without needing sudo! I've also added some added some other metrics, like per-core power and voltage ๐Ÿ˜„

Please check compatibility with your silicon before use, If you want a good experience (see compatibility notes)

Why it do

Because needing to be system admin in order to monitor Apple Silicon frequencies is dumb (yeah, I'm looking at you, powermetrics). So here you go! No administrative privileges needed! Yaaay.

Example Output

Note: The following is a big, nice, juicy output of socpwrbud -a running on a Macmini9,1 (cause I'm a pleb who didn't buy a M1 pro).

Expand Example to see!
Apple M1 T8103 (Sample 1):

	4-Core Icestorm ECPU:

		Supposed Cycles Spent:  1318404262
		Instructions Retired:   1.66480e+09
		Instructions Per-Clock: 1.26274

		Power Consumption: 65.89 mW

		Active Voltage:    825.13 mV
		Active Frequency:  1323.49 MHz

		Active Residency:  29.4%
		Idle Residency:    70.6%
		Dvfm Distribution: 972MHz, 771mV: 52.64% (1086ms)   1332MHz, 800mV: 19.08% (394ms)   1704MHz, 887mV: 7.24% (149ms)   2064MHz, 962mV: 21.05% (434ms)   

		Core 0:
			Power Consumption: 14.53 mW
			Active Voltage:    831.05 mV
			Active Frequency:  1356.95 MHz
			Active Residency:  15.6%
			Idle Residency:    84.4%
			Dvfm Distribution: 972MHz, 771mV: 49.64% (1025ms)   1332MHz, 800mV: 18.59% (384ms)   1704MHz, 887mV: 8.02% (166ms)   2064MHz, 962mV: 23.75% (490ms)   
		Core 1:
			Power Consumption: 13.57 mW
			Active Voltage:    831.42 mV
			Active Frequency:  1361.03 MHz
			Active Residency:  14.9%
			Idle Residency:    85.1%
			Dvfm Distribution: 972MHz, 771mV: 48.81% (1007ms)   1332MHz, 800mV: 20.44% (422ms)   1704MHz, 887mV: 5.65% (117ms)   2064MHz, 962mV: 25.10% (518ms)   
		Core 2:
			Power Consumption: 12.11 mW
			Active Voltage:    838.65 mV
			Active Frequency:  1397.5 MHz
			Active Residency:  12.1%
			Idle Residency:    87.9%
			Dvfm Distribution: 972MHz, 771mV: 47.09% (972ms)   1332MHz, 800mV: 17.68% (365ms)   1704MHz, 887mV: 6.34% (131ms)   2064MHz, 962mV: 28.88% (596ms)   
		Core 3:
			Power Consumption: 7.75 mW
			Active Voltage:    845.17 mV
			Active Frequency:  1424.25 MHz
			Active Residency:  9.0%
			Idle Residency:    91.0%
			Dvfm Distribution: 972MHz, 771mV: 48.17% (994ms)   1332MHz, 800mV: 11.96% (247ms)   1704MHz, 887mV: 7.28% (150ms)   2064MHz, 962mV: 32.60% (673ms)   

	4-Core Firestorm PCPU:

		Supposed Cycles Spent:  3590801722
		Instructions Retired:   1.37992e+10
		Instructions Per-Clock: 3.84294

		Power Consumption: 1912.79 mW

		Active Voltage:    1051.20 mV
		Active Frequency:  3003.88 MHz

		Active Residency:  53.3%
		Idle Residency:    46.7%
		Dvfm Distribution: 600MHz, 781mV: 0.20% (4ms)   828MHz, 781mV: 0.70% (15ms)   1056MHz, 781mV: 1.85% (38ms)   1284MHz, 800mV: 2.17% (45ms)   1500MHz, 812mV: 1.62% (33ms)   1728MHz, 831mV: 1.62% (34ms)   1956MHz, 865mV: 1.63% (34ms)   2184MHz, 909mV: 1.06% (22ms)   2388MHz, 953mV: 0.95% (20ms)   2592MHz, 1003mV: 0.36% (7ms)   2772MHz, 1053mV: 0.72% (15ms)   2988MHz, 1081mV: 0.36% (7ms)   3096MHz, 1081mV: 0.03% (1ms)   3144MHz, 1081mV: 0.43% (9ms)   3204MHz, 1081mV: 86.30% (1781ms)   

		Core 4:
			Power Consumption: 1038.76 mW
			Active Voltage:    1034.99 mV
			Active Frequency:  2895.56 MHz
			Active Residency:  33.9%
			Idle Residency:    66.1%
			Dvfm Distribution: 600MHz, 781mV: 0.31% (6ms)   828MHz, 781mV: 1.07% (22ms)   1056MHz, 781mV: 2.68% (55ms)   1284MHz, 800mV: 3.42% (71ms)   1500MHz, 812mV: 2.54% (52ms)   1728MHz, 831mV: 2.55% (53ms)   1956MHz, 865mV: 2.56% (53ms)   2184MHz, 909mV: 1.65% (34ms)   2388MHz, 953mV: 1.48% (31ms)   2592MHz, 1003mV: 0.56% (12ms)   2772MHz, 1053mV: 1.13% (23ms)   2988MHz, 1081mV: 0.56% (12ms)   3096MHz, 1081mV: 0.05% (1ms)   3144MHz, 1081mV: 0.67% (14ms)   3204MHz, 1081mV: 78.77% (1626ms)   
		Core 5:
			Power Consumption: 687.02 mW
			Active Voltage:    1044.88 mV
			Active Frequency:  2970.58 MHz
			Active Residency:  21.5%
			Idle Residency:    78.5%
			Dvfm Distribution: 600MHz, 781mV: 0.02% (0ms)   828MHz, 781mV: 0.25% (5ms)   1056MHz, 781mV: 2.36% (49ms)   1284MHz, 800mV: 2.66% (55ms)   1500MHz, 812mV: 2.22% (46ms)   1728MHz, 831mV: 2.20% (45ms)   1956MHz, 865mV: 2.41% (50ms)   2184MHz, 909mV: 1.72% (35ms)   2388MHz, 953mV: 0.81% (17ms)   2592MHz, 1003mV: 0.11% (2ms)   2988MHz, 1081mV: 0.01% (0ms)   3096MHz, 1081mV: 0.01% (0ms)   3204MHz, 1081mV: 85.22% (1759ms)   
		Core 6:
			Power Consumption: 23.26 mW
			Active Voltage:    836.13 mV
			Active Frequency:  1626.58 MHz
			Active Residency:  3.1%
			Idle Residency:    96.9%
			Dvfm Distribution: 600MHz, 781mV: 0.19% (4ms)   828MHz, 781mV: 0.54% (11ms)   1056MHz, 781mV: 15.96% (329ms)   1284MHz, 800mV: 18.74% (387ms)   1500MHz, 812mV: 15.62% (322ms)   1728MHz, 831mV: 15.51% (320ms)   1956MHz, 865mV: 15.60% (322ms)   2184MHz, 909mV: 11.87% (245ms)   2388MHz, 953mV: 5.66% (117ms)   3204MHz, 1081mV: 0.31% (6ms)   
		Core 7:
			Power Consumption: 60.56 mW
			Active Voltage:    895.57 mV
			Active Frequency:  2009.28 MHz
			Active Residency:  4.0%
			Idle Residency:    96.0%
			Dvfm Distribution: 828MHz, 781mV: 0.17% (4ms)   1056MHz, 781mV: 12.91% (266ms)   1284MHz, 800mV: 14.16% (292ms)   1500MHz, 812mV: 11.83% (244ms)   1728MHz, 831mV: 11.81% (244ms)   1956MHz, 865mV: 11.79% (243ms)   2184MHz, 909mV: 8.32% (172ms)   2388MHz, 953mV: 4.13% (85ms)   3204MHz, 1081mV: 24.89% (514ms)   

	8-Core Integrated Graphics:

		Power Consumption: 2.42 mW

		Active Voltage:    627.71 mV
		Active Frequency:  711.288 MHz

		Active Residency:  2.6%
		Idle Residency:    97.4%
		Dvfm Distribution: 396MHz, 400mV: 2.69% (56ms)   720MHz, 634mV: 97.31% (2008ms)   

Features

The following is sampled per-cluster and is available for all sampled compute units!

  • CPU/GPU
    • Active and Idle Residencies
    • Active Frequencies and Voltage
    • DVFS Distribution and Time Spent
    • Power Consumption
  • CPU Only
    • Total (cluster) Instructions Retired and Per-cylce
    • Total (cluster) Supposed CPU Cycles Spent
    • Per-core metrics
    • Micro architecture names

I would love to support ANE stuff too but thats just a false dream encouraged by compiled remnants in powermetrics...

Installation, Usage, and Making

Note: Tool usage is listed by socpwrbud --help!

Install using Homebrew

  1. If you dont have Hombrew, then what the heck? Install it already, geez.
  2. Add my tap using brew tap dehydratedpotato/tap
  3. Install the tool with brew install socpwrbud
  4. Run socpwrbud! (dont ask why "power" is shortened for the binary name)

Install manually

  1. Download the bin from latest release.
  2. Unzip the downloaded file into your desired dir (such as /usr/bin)
  3. Run socpwrbud! (still, dont ask why "power" is shortened for the binary name)

Building yourself

Xcode proj is in source but you can build with make if you so desire...


Outside Influence

This project has recently influenced the CPU/GPU power related metric gathering on NeoAsitop! Yay! Go check it out โค๏ธ

Compatibility Notes

Here's a sick table. Depending on what Apple decides to break, it doesn't mean anything. How cool is that?

Silicon Codename Support Status
M1 t8103 Fully working
M1 Pro t6000 Works (But no tests for binned 8-Core model)
M1 Max t6001 Fully working
M1 Ultra t6002 Should work maybe? (see #5 and patch v0.3.1)
M2 t8112 Should work?
M2 Pro t6020 i dont know man
M2 Max t6021 like for real

Contribution

If any bugs or issues are found, please let me know in the issues section. If the problem is related to missing IOReport entries, please share the output of the iorepdump tool found in the latest release. Feel free to open a PR if you know what you're doing ๐Ÿ˜„

socpowerbud's People

Contributors

dehydratedpotato avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.