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

Option to disable live vu-meter feature #44

Open
maxux opened this issue Aug 15, 2020 · 8 comments
Open

Option to disable live vu-meter feature #44

maxux opened this issue Aug 15, 2020 · 8 comments

Comments

@maxux
Copy link

maxux commented Aug 15, 2020

I really like the vu-meter like pavucontrol does, but I'm that kind of guy who keep that stuff running h24 and it eats ~5% cpu all time.
I guess it's related to the runtime sampling for monitoring the volume per source. Original pavucontrol have the same behavior.

I think, if we can disable the vu-meter feature and just listening for event, it could reduce cpu usage to about nothing. I didn't checked the code yet, I'll take a look when I'll have time and prepare a pull request if possible.

@maxux maxux changed the title Option to disable vu-meter feature Option to disable live vu-meter feature Aug 15, 2020
@c0r73x
Copy link
Member

c0r73x commented Aug 18, 2020

We do have toggle_static to disable the realtime vu-meter. Not sure if we added a config for it to enable/disable it by default, but I think i did.

Update: Checked it now and we do have it in the theme section in config theme.default.static_bar as boolean value.

@maxux
Copy link
Author

maxux commented Aug 18, 2020

I confirm, I switched the setting to true and vu-meter seems disabled and bar is filled up-to-cursor with plain color. But cpu usage doesn't change at all, still ~6-7% all the time. Does this option just disable ui vu-meter or does it stop monitoring pa streams ?

@c0r73x
Copy link
Member

c0r73x commented Aug 18, 2020

I'm quite sure it should stop the monitoring but I might be wrong, it was some times since i implemented it.

@maxux
Copy link
Author

maxux commented Aug 21, 2020

From what I saw on the code (quickly on pa.cpp at least), there is always a create_monitor_stream_for_paobject for each stream, whatever is the value of static_bar, so basically there is always a request of a copy of all streams to ncpamixer.

Actually, static_bar is only used on the ui, value of static_bar doesn't have any impact on pa code.

@c0r73x
Copy link
Member

c0r73x commented Aug 21, 2020

Ok, should be easy to destroy the monitor streams when switching to static_bar, i will look into it.

@maxux
Copy link
Author

maxux commented Aug 21, 2020

Well I'm actually doing some test locally, commenting monitor doesn't seems to really reduce usage. I'm investigating :)

@maxux
Copy link
Author

maxux commented Aug 21, 2020

After some profiling and investigation, here it is:
The thread dedicated to pulseaudio drop from ~1.2% cpu usage to 0.0% when commenting create_monitor_stream_for_paobject calls. So there is an improvement by stopping stream.

But major cpu time (of the other thread) is spent on drawing the ui. ~5% cpu usage for redrawing the ui, by growing the usleep in the Ui::run from 20000 to 80000 reduce cpu usage to ~1.5% without (IMO) adding lag on interface usage.

Obviously, when you want the vu-meter, you need to keep 20000 microsec to get a correct refresh rate.

Quick fix would be to disable create_monitor_stream_for_paobject calls when static_bar is enabled and change the refresh rate.

Better improvement would switch refresh to update event only (on key press or pa event fired), this would avoid refreshing continuously and keep same code path for all situation, but this would be a way larger change on the code.

@c0r73x
Copy link
Member

c0r73x commented Aug 24, 2020

I did start on a major rewrite in dev but I havn't gotten to finishing it yet, But that rewrite is about detaching the ui from PA to be able to use diffrent backends like CoreAudio (osx) or even Alsa. During this rewrite would be a nice place to implement this but atm it would be to much of a change.

I guess I will have to take some time and finish the dev branch :P

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

No branches or pull requests

2 participants