Analysing average CPU usage percentage of a trace from instruments

Hello, I would like to obtain the average CPU usage of a trace I ran through instruments by looking at the cpu profiler. Is there any way to do this? Or should I be using another instrument.

We don’t have a place that information is directly surfaced in the UI. However, you can calculate it by gathering three pieces of information:

  1. The total number of samples, shown at the bottom-right corner of the call tree or flame graph
  2. The duration applied to each sample (1ms by default, or 100µs if “High Frequency” was checked in the Time Profiler instrument’s recording options)
  3. The duration of the trace (shown at the right side of your ruler; in your case: 39.168 seconds) or selected time range (shown when hovering over the left or right edge of the selection)

Then, multiply the number of samples by the per-sample duration, and finally divide by total trace or time range duration. Note that this has some inaccuracy because it does not measure the exact times when each thread goes on and off the CPU, but for a trace longer than a few seconds where your process is mostly performing CPU-bound work it should be reasonably accurate.

Please file a report using Feedback Assistant (see: https://developer.apple.com/bug-reporting/) and share the number here so we can track your request for to display this in the UI.

Analysing average CPU usage percentage of a trace from instruments
 
 
Q