Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constant CPU Usage #36

Open
innatum opened this issue Jun 25, 2023 · 5 comments
Open

Constant CPU Usage #36

innatum opened this issue Jun 25, 2023 · 5 comments

Comments

@innatum
Copy link

innatum commented Jun 25, 2023

CPU usage for this plugin is constantly 1-3%, regardless of how long the Streamdeck has been unused and inactive. Any reason? All other Streamdeck plugins are at 0% usage.

Windows 10 64-bit. Running Streamdeck software 6.2.1.18825 (latest version).

image

@TsarNicholas
Copy link

Same for me. Love the plugin and easily changing mixes - just getting strangely high cpu usage.
Stream Deck Total Mix CPU Usage

@shells-dw
Copy link
Owner

Sorry for responding so late, I was kind of preoccupied with work and my Fireface PSU died, took me a while to get a replacement so without the interface I couldn't really look into the issue.
However I'm back on track now.

Yes, that is to be expected, sadly.

The way this works is that RME's OSC implementation works basically as MIDI. It's not a event based or some kind of API endpoint you could query for individual values, so the only way to get the Stream Deck plugin updated with changes made to the device itself (or with TotalMix) is to send a query to the device to dump all its settings, then capture the response and parse all the lines individually and get the data into the plugin. To make it as responsive as possible while maintaining a somewhat manageable CPU load (depending on your CPU I guess - but based on my experience when working with DAWs and audio generally on Windows, more cores are alwasy better anyway) I do that multiple times per second (to roughly a second, the device needs some time to respond too)
I tried balancing it for CPU usage and responsivity, but there is always a bullet to bite. Either it's taking the plugin multiple seconds to display (and know of) changes made to TotalMix and have a bit lower CPU usage or have a bit higher CPU usage and display it more or less in real time.
What does help is to limit the channels in TotalMix (Options - Settings - OSC "Number of faders per bank") to the number of channels you actually use. With less channels there is a significantly less amount of data the plugin has to go through and parse. If I recall correctly, it's roughly 90 lines to parse every request for 8 channels and around 800 for 24 - meaning if you're only using (or rather are in need of controlling with Stream Deck) 8 or less channels, set the value to 8 and it will be more responsive and consume less CPU.

Anyhow with things being as they are, I can't really do aynthing about it.

If you wouldn't need anything to be mirrored to the Stream Deck and are CPU limited, you can go in the plugin config and disable mirroring all together. Open %appdata%\Elgato\StreamDeck\Plugins\de.shells.totalmix.sdPlugin\de.shells.totalmix.exe.config with a text editor and set "mirroringRequested" to false, then restart Stream Deck) which will basically eliminate the CPU usage, but at the cost that nothing is mirrored anymore.

Sadly that's all I can do here. Hope that helps :)

@innatum
Copy link
Author

innatum commented Aug 2, 2023

No worries. I appreciate your thorough explanation and suggestions. Thank you for the plugin, @shells-dw

@touchup1954
Copy link

touchup1954 commented Aug 3, 2023 via email

@VV-Cephai
Copy link

For my system (Ryzen 5950X), at the current mirroring frequency, the CPU load caused by streamdeck-totalmix is constantly around 5% to 6%. This is huge.
240329-121211-1194x115-Taskmgr-Task_Manager
It causes the CPU to increase its clock speed, the fans to audibly spin up and my system's measured idle power consumption to increase by 40W continuously.
240329-121200-1691x587-chrome-Overview_–_Home_Assistant_-_Google_Chrome
(Mirroring enabled in config at 12:00)

In short, the mirroring feature of this plugin is currently unusable.
I have not looked through the code yet, but if it is not possible to drastically improve the efficiency of the status readback, would it be possible to make the mirroring frequency adjustable? perhaps once per minute and every time the relevant stream deck buttons are pressed would be good. That way the deck would still generally track and display the status of the controls, without costing 1.3 cents per hour in power to run.

I don't know if this is helpful, but the software totalmix-volume-control (https://github.com/fgimian/totalmix-volume-control), which I also use, does a similar thing and never shows CPU usage above 0.1%. When the volume buttons are pressed, it displays an overlay showing the current fader volume of total mix. As long as this window is displayed, it mirrors the fader value in real time as it is moved in the Total Mix interface (update rate 10 Hz +). By pressing a volume key every ~3s and moving the faders in Total Mix rapidly, this overlay can be kept on screen and updating. Even doing this for a full minute did not increase the CPU load by more than 0.1%. This suggests that there may be a more efficient way to read back the Total Mix status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants