Dwarf plugin CPU usage

I managed to get a working Plugin CPU usage meter. It seems to work pretty well, although it can’t take into account plugins which run calculations on other threads like NAM and convolvers.

It’s practically free: each plugin already runs on its own jack thread, and the kernel accounts that thread’s CPU time whether anyone reads it or not. The audio callback gains one predictable branch per cycle; the readings themselves happen on the non-RT protocol thread, once a second, and only while the panel is open. Plugins that offload to LV2 worker threads under-report, since only the RT thread is measured.

It’s LLM coded so I can’t take any real credit for it

@falkTX what do you think?

5 Likes

@StefanD, I think something very similar to your feature was already implemented by @falkTX for Anagram.

See: Add monitor_cpu_load command (#2) · Darkglass-Electronics/mod-host@83edc3d · GitHub

It’s a monitor rather than a snapshot, as you’ve implemented, and it’s a very nice feature to have. I’d like to see if we can refactor it to reuse the same code and calculations, though.

5 Likes

What I showed above is also a monitor and not a snapshot, the percentages move live.

And thanks for pointing out the Darkglass work! Indeed falkTX’s work was better since it counted the max usage instead of mean (which is a better predictor for xruns) so I rebased my UI on top of that work now and made a mod-host PR which adds his work to Starless.

4 Likes

Often the act of measurement introduces more CPU load, so keep that in mind :wink:

1 Like

If we start talking quantum physics, I’m outta here! :smiley:

5 Likes