Following from question in comment here, is there any easy way to get CPU usage on a per core basis at a certain interval throughout the day? (e.g. every 60 seconds)


  • happy to use a script (e.g. ruby, python) and run it in the terminal
  • would be great if the output were a simple csv, but open to using more sophisticated tools/outputs if they exist and are easy to use
  • the ultimate goal is to take to plot a time series of per-core utilisation over the day (or week/month) (that is, a line chart with as many lines as cores)
  • In case it's of significance, I will try to run this on a MacBook Pro

Example output:

A csv that resembles:

time, core_1, core_2, core_3, core_4 (etc)
"2020-07-18 15:45:00 UTC", 15%, 12%, 0%, 1%
"2020-07-18 15:46:00 UTC", 100%, 100%, 10%, 3%
"2020-07-18 15:47:00 UTC", 10%, 2%, 0%, 0%
etc etc

There is a tool that can collect this information called glances, which is a command line based monitoring tool that can track all sorts of parameters.

It can be installed via homebrew:

brew install glances

You may need to tinker with the options to get something you're happy with, or parse the data downstream with a different tool, but it can output timestamped, percpu usage (in 60 second intervals) in the following way:

glances --stdout now,percpu --time 60

The results aren't quite what you outlined, but the output can be processed with other tools to get them into a format that you can use.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .