My Macbook Pro occasionally will use up high CPU and freeze after being left idle overnight. How can I enable process accounting so that I can track down the processes that consume most of the CPU?
You can either use an app to turn on process accounting or use command line tools:
Open Terminal and enter:
sudo mkdir /var/account sudo touch /var/account/acct sudo accton /var/account/acct
sayou can print the system accounting statistics. Check
- Activity Monitor is your first item to track down CPU usage.
- Next is to get Xcode and use Instruments. That can do far deeper introspection and trace in to the system and apps.
- The deepest level is
dtracewhere you can literally pick apart system calls.
You should use these in order since the second and third need you to relax system integrity or enable a privileged helper. It's not really a huge security risk, but if you can get the accounting you need from Activity Monitor - better to keep all macOS security in place.