From bbef713741473bc3f207dc5b6c252d7df7e38a44 Mon Sep 17 00:00:00 2001 From: Raghavendra D Prabhu Date: Sat, 8 Dec 2012 23:24:47 +0530 Subject: [PATCH] status: reduce wakeups with display_bitrate enabled When system was profiled for wakeups, a high wakeup rate from mpd was observed even when paused. Strace-ing mpd pointed at excessive polling even though mpd_communication_mode is set to notifications. By method of elimination in the configuration, it was narrowed down to display_bitrate. By code inspection, it could be seen that Mpd.isPlaying() is true even if mpd is paused, but it doesn't make sense as to why bitrate needs to be constantly updated even when mpd is paused. Hence the patch. Signed-off-by: Raghavendra D Prabhu --- src/status.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/status.cpp b/src/status.cpp index 144643e5..67693e21 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -80,7 +80,7 @@ void Status::trace() { past = Timer; } - else if (Config.display_bitrate && Global::Timer.tv_sec > past.tv_sec && Mpd.isPlaying()) + else if (Config.display_bitrate && Global::Timer.tv_sec > past.tv_sec && Mpd.GetState() == MPD::psPlay) { // ncmpcpp doesn't fetch status constantly if mpd supports // idle mode so current song's bitrate is never updated.