CPU usage monitoring on M1 Mac

When evaluating CPU usage of an in development plugin on PC or Intel Mac I usually load a single instance of said plugin in reaper and check the CPU percentage at the bottom of the container window.
I also make sure the CPU is running at its maximum clock speed beforehand by running a CPU intensive process in the background (typically a simple batch or perl infinite loop).

This works fairly well on x86 CPUs, with consistent readings and lower CPU usage than without the background loop, but I was not able to use the same strategy on the M1 chip.

It looks like the high-performance / high-efficiency core dichotomy is responsible for this, the loop running on a high-performance core while the plugin is running on a high-efficiency on.
I might well be missing something here, but the end result is that CPU usage is unchanged with or without the background loop, is not very stable, and is also notably higher than expected (read higher than the Intel counterpart).

Any idea on how to determine CPU usage on M1 chips?

If I understand your goal it is to evaluate your product (plug-in).
If that’s the case,
Apple provides Instruments which has many tools to profile your app.
It can also be attached the host if you build a dll (vst3/component).

1 Like

See also AudioProcessLoadMeasurer, for evaluating the CPU usage of your audio DSP specifically. It will give you much finer detail than a percentage in a DAW.

It won’t tell you about bottlenecks in graphics code, however, and that’s one area (of many) where Instruments can help.

4 Likes

Sounds interesting!
I will look into that, thank you.

Oh that looks nice! I did not know this existed, thank for pointing this out.

That said, I can see how this could be used to evaluate the efficacy of a given modification, but what I want to know is the real world CPU usage (percentage) of my plugin. The idea is to be able to know how many instances of a given plugin a user might be able to run on a given system for example (without having to do so myself ;)), or simply answer user general questions about the plugin CPU usage.

Also, will this load measurement give the same results regardless of the CPU clock frequency?
If it is anything like linux’ load average measurement then it does not, at least for low loads that do not force the CPU into its maximum clock speed (and with a process that might also stay on high efficiency cores on the M1)

You might find that just running as many instances in Reaper as possible before you hit overruns and dividing out by the total instance count gives you a reasonable worst-case number for the percentage used per instance, and this won’t be affected by the performance/efficiency split anywhere near as badly. That will also give pretty good vs Rosetta and vs Intel native figures, and a truer number overall as most users are going to be using the plugin on a reasonably well loaded-out DAW session.

You may find in Reaper the CPU usage is even affected by whether the GUI is open or closed (which I think is also due to this performance/efficiency split) depending on how often the UI refreshes itself; so best to close the UI when testing (as most users are going to have the majority of their plugin UIs closed most of the time it seems reasonable to me).

1 Like

That is what I was trying to avoid, but you are right that this is probably the most accurate way of doing this.
Thanks for the heads-up regarding the UI.