Show CPU usage on module's front panel?

Hello! Is there a way to show a module’s CPU usage on the front panel? Another way to ask the same thing: Is there function for fetching a module’s CPU usage?

I’m working on a granular effects processor and certain configurations can cause high CPU usage… but also make awesome sounds. I’d like to display the CPU usage to the end user so that they can adjust settings to their preference without them having to turn on the CPU Meters. If that’s not possible, no stress.


Engine > CPU meter or F3.

Thanks @Vortico. I was aware of that already. I was hoping that I could draw my own CPU usage meter directly on my module.

There is Module::cpuMeter, but there is no use of that variable for plugins, so it has been removed in Rack v2.

Ok, no worries. Thanks Andrew!

I suppose you could try something like this in the process method :

double t0 = getHighResolutionClockTimeInSeconds(); // imaginary function, you'd need to implement this for each platform yourself, I guess...
// your module processing...
double t1 = getHighResolutionClockTimeInSeconds();
cpuPercent = (t1-t0) / (1.0/sampleRate);

You might however end up with issues like how accurately can you measure the elapsed time or do the calls to get the clock time themselves use a non-trivial amount of CPU…

It’s very tough to reliably measure your own self time and get a stable, meaningful number. I run my process code in a right loop outside of VCV and search to how many times I can call it in a second. Calling it a huge number of times in a loop gives a very stable reading, I get maybe three decimal places of meaningful data: Here’s most of the code: