xbmc/xbmc — pull request #2637 by dagwieers (2013-04-20 01:08:22+00:00)
Title: Increase USB and CEC rescan interval to 5 seconds

In one of my investigations to see why XBMC performance is so bad (even when idle) I found one of the threads (in my case PeripheralBusCEC) scan a big sysfs tree recursively. On the 1Ghz AppleTV 1 device this would be about 2% of the CPU **every** second. For the USB thread we luckily have Udev events, but for CEC it is using sysfs polling which is quite expensive. It would be better to make use of Udev as well for CEC (where available) however 5 seconds should be fine for everyone.

In my own builds I even brought it down to 30 seconds. Which means 29 seconds of reduced CPU usage.

The CEC polling probably should be more restricted to specific sysfs sections, or preferably use Udev as well, when available.

PS XBMC needs a special idle-state where it can turn down these expensive threads to make sure hardware can go into deeper sleep states. Especially for devices that doesn't do suspend for various reasons this is a requirement. (The ATV1 device for instance gets warm even when idle) If we can combine display-sleep with low-power states and a less expensive main-loop, that would be already quite an improvement without needing a complete refactoring of the code.