Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Bubbler328

macrumors member
Original poster
Sep 28, 2014
37
3
Trying to remotely help a friend troubleshoot what’s causing his 2017 iMac on Ventura to slow down and pin CPU cycles to 100% randomly. It’s a beefy machine for its time, i7, 32gb RAM, 8gb Radeon card.

He recently had his HDD fail and had someone in his town swap in an SSD so of course he expected faster performance but he’s randomly hitting these slow downs a few weeks post repair.

He says he sometimes comes into his shop (he’s a mechanic) and the machine is full fans, or he’ll hear it kick on full fans while he’s working.

I had him open activity monitor and there were a few random sustained CPU spikes today but of course he hasn’t been paying close attention to the screen since he’s got work to do in the shop, hence why I’m asking to see if anyone knows if there is historical logging that shows what apps were taking up CPU cycles at a given time.

Thanks
 

MacCheetah3

macrumors 68020
Nov 14, 2003
2,102
1,075
Central MN
It’s not the most elegant solution, but you could use the top CLI command.

Basically, paste (something similar to) this into Terminal and press Enter/Return:
Code:
top -o cpu -ncols 3 -n 10 -l 360 > ~/Desktop/process_log.txt

Explanation:

-o flag is what key to order the results. In this case, we’re choosing by CPU usage. The default order is descending.
-ncols flag is to specify the number of columns. I’ve limited it to three so the results only include the Process ID (number), the process name (labeled as COMMAND), and the CPU usage percentage, which seems like all you should need/want for troubleshooting.
-n flag is the number of processes to include. I figure the top 10 highest usage should suffice.
-l flag activates logging mode, which returns/outputs a set number of samples. The default sampling is unlimited with a delay time of one second (in other words, one sample per second). So, for a minute of logging, you’d add/input 60 to the -l flag. Of course, an hour would be 360 samples, a day is 86400 samples, etc.
> redirects the output from the CLI to a (text) file. In my example, the output file is saved to the user's Desktop with the name process_log.txt. Based on my testing, the output file size is about 53 KB per minute (i.e., 60 samples) of logging, which is much better than the default top output, creating file sizes of about 13 MB per minute of logging.

P.S. (Reminder) The reported CPU usage percentage is 100% per core. Therefore, the 7th generation Core i7, with its four physical cores and 4 virtual cores via HyperThreading, can have a reported CPU usage of up to 800%.
 
Last edited:
  • Like
Reactions: Brian33 and bogdanw
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.