How to See Individual Core CPU Usage on Mac with powermetrics
There are various ways to monitor CPU usage on a Mac, with perhaps the two most common being with Activity Monitor on the graphical interface side of things, and htop or top on the command line side. While you can show an optional core graph in Activity Monitor, and htop will show CPU core activity as well, there’s another lesser known command line tool called powermetrics that can reveal this information to you as well.
If you’ve a savvy command line user and you’ve never heard of powermetrics before, welcome to the club. I hadn’t either until I stumbled into an article at eclecticlight.co which discussed various ways of seeing CPU core activity with a mention of the ‘powermetrics’ command line tool so naturally I was inspired to investigate something new to me. Sharing is caring, so let’s review how you can use this command as well.
The powermetrics command is useful for both ARM and Intel Macs, but has some additional features that are unique to Apple Silicon Macs that allow you to see information about GPU activity and efficiency cores. With
Using powermetrics to Monitor Individual CPU Core Activity on Mac
powermetrics must be run as root user, so all commands will be prefixed with sudo accordingly.
The most basic powermetrics command is as follows, which will report back a continual feed of information regarding all power metrics for CPU and GPU on the Mac, including individual core activity:
sudo powermetrics
You can also see a usage summary of CPU power and GPU power:
sudo powermetrics --samplers cpu_power,gpu_power --show-usage-summary
What’s unique about powermetrics compared to other popular tools like htop, top, or even Activity Monitor, is that it’s continuously printing new information into new lines, rather than simply updating CPU core activity on a single screen. This can make powermetrics a bit of a firehose, and even take up quite a bit of memory if you let it run amuck for an extended duration. That can be handled in a variety of ways, including, as EclectlicLight recommends, to output the data into a text file which can be parsed or analyzed independently. The example command given is:
sudo powermetrics -i 100 -o powermetrics.txt -n 10 -s cpu_power
This provides you with a text file named ‘powermetrics’ containing the last 10 entries specific to cpu_power (which gives you Core activity) as sampled every 100ms.
Cheers to eclecticlight.co for pointing out an interesting new command line tool to explore!
Personally, I use htop and/or Activity Monitor all the time, and I either have the latter open all the time with the Dock CPU Monitor active, and easily accessible by keyboard shortcut to launch it quickly when I don’t. If I’m at the command line, I tend to have htop running in another Terminal window as well.
Just pointing out the obvious, perhaps, but such tools can take a heavy toll on overall system performance.
In my experience with such tools, the *worst* time to try to fire them up is when you’re having a problem! If the problem is related to system load, the tool is only going to make things worse.
Conversely, I find that keeping such a tool running all the time noticeably reduces performance of other applications.
It seems that the best way to use such tools is to anticipate problems, and fire them up *before* you do something that you think might have a performance issue.