Using Apple Instruments to monitor Max CPU usage

Nicolas's icon

Hi, I've been lurking this forum since years, I always found what I was looking for. Not today.

I built a denoiser patch, and would like to monitor cpu use, adjusting various settings, and enabling / disabling features (deleting parts of my patch). For this purpose, I use Apple instruments, more specifically a PMC counter.

I understood that the numbers I get (see picture attached) tells me how often each thread is calling CPU in a given interval. So I run the recording on a given period of time, and the more the cpu gets called, the more cpu intensive my patch is.

First, am I right in theses assumptions ? Is there a simpler way to do this ? The dsp monitoring in max is not useful for me because I would like to have absolute values and not values relatives to my patch.

So, assuming I'm right so far, I see 2 threads calls that are highly correlated to the complexity of my patch :
- The first one is called "start" and seems to use the cpu when there is dsp processing (ie when my patch is fed by a signal).
- The second one is called "thread_start" and is also highly correlated to the complexity of my patch, but there's no difference if my patch is fed by a signal or not. It seems to be stuff needed for objects. It contains a subthread named ""dspchain_tick" that seems to group threads relatives to objects. But once again I don't see changes if there is dsp processing or not (or maybe there is even if no signal ?).

You might ask me why the fuck am I looking at such things.. It is because I would like to monitor only the cpu calls made for dsp processing, and throw out anything else (graphic, max structure etc).

So my final question is :
Where can I find information about this ?
And am I even doing it the right way ?

Sorry it's not a really fun thing to discuss.

Capture-d’écran-2016-09-26-à-18.42.31.png
png
Nicolas's icon

lil' bumping

Nicolas's icon

Hi, if some people need this one day, it seems that the thread "plugrunner_process" can give me what I was looking for.
It contains threads named as the ones that use the most ressources in my patch (mainly pfft for my patch).
It goes down with a simpler patch, and rise with a more complicated.

It's not that stable but doing 10 measures of 10 seconds and averaging all I can get usable things. It seemed important to use the smallest pad possible (micro second) to get more precise results.

Capture-d’écran-2017-02-10-à-11.36.11.png
png