Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.
Have you disabled the "Show volume meters" option on the configuration tab? If volume meters are enabled, some cpu use is expected, because pavucontrol is monitoring the sound cards even if nothing is playing.
Hi @vinc17 could you please have a look if cpu usage is due to pavucontrol process or pulseaudio process? E.g. look in the top sorted by cpu usage.
If this is due to pulseaudio process, please attach your pa-info output.
If this is indeed due to pavucontrol process, can you do some profiling of what it's doing? E.g. perf top -p <pid of pavucontrol process> would be a good start.
For pulseaudio, about 5-6% CPU time. For pavucontrol, about 4% in the Playback tab and about 2% in the Configuration tab. This doesn't seem to be very high, but this is sufficient to activate the fan (otherwise the machine is mostly idle, so this is a huge increase of CPU usage).
If your audio hardware supports 48000 rate and you are usually playing 48000 audio your system may benefit from default-sample-rate = 48000 in /etc/pulse/daemon.conf, this should help with cpu usage by pulseaudio daemon by removing the need to resample.
2..4% does not look that big, guess noone looked into whether that could be improved. You can slightly reduce cpu usage by making a change to peaks resampler rate, reducing it will also reduce painting overhead:
Actually I now don't think that the CPU usage is really the issue. The powertop utility gives interesting information when running on battery (i.e. with the power cable unplugged).
Without pavucontrol running:
The battery reports a discharge rate of 16.9 WThe energy consumed was 400 JThe estimated remaining time is 3 hours, 53 minutesSummary: 765.7 wakeups/second, 0.0 GPU ops/seconds, 0.0 VFS ops/sec and 9.2% CPU use Usage Events/s Category Description 2.2 ms/s 206.8 kWork dbs_work_handler 1.7 ms/s 76.4 Timer tick_sched_timer 5.7 ms/s 66.5 Process [PID 18654] /usr/local/firefox/fi 4.2 ms/s 59.7 Process [PID 18719] /usr/local/firefox/fi 3.9 ms/s 57.7 Process [PID 19348] /usr/local/firefox/fi 5.3 ms/s 51.3 Process [PID 18659] /usr/local/firefox/fi 12.8 ms/s 46.5 Process [PID 19340] /usr/local/firefox/fi 7.1 ms/s 20.4 Process [PID 18537] /usr/local/firefox/fi[...]
With pavucontrol running, Configuration tab:
The battery reports a discharge rate of 23.3 WThe energy consumed was 468 JThe estimated remaining time is 2 hours, 45 minutesSummary: 1325.7 wakeups/second, 0.0 GPU ops/seconds, 0.0 VFS ops/sec and 13.5% CPU use Usage Events/s Category Description 4.3 ms/s 361.7 kWork dbs_work_handler 30.7 ms/s 127.9 Process [PID 6529] /usr/bin/pulseaudio -- 3.2 ms/s 156.7 Timer tick_sched_timer 100.0% Device Audio codec hwC1D0: Nvidia 5.5 ms/s 66.4 Timer hrtimer_wakeup 9.8 ms/s 50.7 Process [PID 27446] pavucontrol 11.4 ms/s 49.2 Process [PID 19340] /usr/local/firefox/fi 2.8 ms/s 47.4 Process [PID 18719] /usr/local/firefox/fi 595.1 µs/s 48.3 Interrupt [6] tasklet(softirq) 1.5 ms/s 47.0 kWork hci_tx_work 0.9 ms/s 46.1 kWork hci_rx_work 5.2 ms/s 44.0 Process [PID 18654] /usr/local/firefox/fi[...]
With pavucontrol running, Playback tab:
The battery reports a discharge rate of 23.4 WThe energy consumed was 470 JThe estimated remaining time is 2 hours, 44 minutesSummary: 1409.7 wakeups/second, 0.0 GPU ops/seconds, 0.0 VFS ops/sec and 14.9% CPU use Usage Events/s Category Description 4.4 ms/s 382.7 kWork dbs_work_handler 26.0 ms/s 160.7 Process [PID 6529] /usr/bin/pulseaudio -- 3.5 ms/s 166.0 Timer tick_sched_timer 100.0% Device Audio codec hwC1D0: Nvidia 22.0 ms/s 70.1 Process [PID 27446] pavucontrol 5.4 ms/s 69.5 Timer hrtimer_wakeup 0.9 ms/s 49.3 Process [PID 18659] /usr/local/firefox/fi 492.6 µs/s 48.6 Process [PID 19348] /usr/local/firefox/fi 551.8 µs/s 48.3 Interrupt [6] tasklet(softirq) 1.5 ms/s 46.9 kWork hci_tx_work 0.9 ms/s 45.8 kWork hci_rx_work 2.3 ms/s 41.0 Process [PID 18719] /usr/local/firefox/fi[...]
See the energy consumption. The issue might be the "Audio codec hwC1D0: Nvidia" usage.
After doing additional tests with powertop, it seems that there is no issue when I run pavucontrol if "Show volume meters" is initially unticked. But if I tick it and untick it again, the problem with energy consumption and "Audio codec hwC1D0: Nvidia" 100% usage occurs again... until I quit pavucontrol.
Ok this could be pulseaudio problem. If I stop all audio players and run pavucontrol with volume meters initially unticked the monitor source from which pavucontrol reads peaks stays SUSPENDED. If I tick volume meters and then untick again, that monitor source goes to IDLE but never to SUSPENDED again. If I close pavucontrol, it returns to SUSPENDED.
At the same time, the sink corresponding to that monitor source also goes into the same state. If it does not return to SUSPENDED there will be no suspend call to alsa which likely prevents device from suspending.
You can check state with pactl list | grep -A1 -E "(Sink)|(Source)" it should go like this and State is displayed on second line; here Source Output #29 is pavucontrol with peaks resampler:
Hi @vinc17 I now added pulseaudio!697 (merged) fix which should allow pulseaudio to release devices when you untick Show volume meters in pavucontrol. Would be nice if you could test that change and confirm it works for you.
I've just tested with and without the patch, and I confirm that the patch fixes the issue when I untick Show volume meters in pavucontrol (i.e. everything goes from IDLE back to SUSPENDED after a few seconds).
Linux XXX 5.10.0-16-amd64 #1 SMP Debian 5.10.127-2 (2022-07-23) x86_64 GNU/Linux
on a desktop PC. I have a Juli@ sound card, GTX 2080 Super (with HDMI output) and an Avantree USB bluetooth device. I don't recall this behavior prior to installing the graphics card.
@dantzler The SUSPENDED/IDLE issue is just part of a more general issue and is about unticking Show volume meters in pavucontrol without restarting pavucontrol. What you haven't said is whether Show volume meters is ticked or not in pavucontrol when you start it. If it is ticked, this is this issue. If it isn't, this is some unknown issue.
Same issue here. When that volume meters are enabled, the CPU load from pavucontrol goes to 3-10% (before 0.3-3%) and the worst part, the Xorg process usage changes to 11-17% (before about 3%). That means: the consumption of the current solution is almost a whole Ryzen core of CPU load.
IMHO that deserves at least a warning when somebody ticks the VU meter checkbox.