Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#37 LCDd process wakes up too often

closed-invalid
nobody
server (16)
5
2011-04-23
2011-04-23
Anonymous
No

LCDd wakes up *much* more often than required, consuming CPU on my otherwise idle device.

Looking at an strace and the main.c code, the real killer is the 'process' loop, which wakes up 32 times/second when most of the time there is nothing to do.
I believe the right fix here is to move the select() call out of sock_poll_clients() and up to the main loop. Use the select timeout as the render timeout and remove the explicit process loop entirely. Increased responsiveness with decreased CPU wastage.

(The next step then would be to remove the frequent render timeout (8/second) considering that my 'machine is idle' LCD is only actually changing every second (to blink the clock) - but that will require more code reading)

Discussion

  • Markus Dolze
    Markus Dolze
    2011-04-23

    The main loop is time driven by design. Even if nothing happens (no input from clients is available) screens and key events (which are processed separately) are updated every 1/8th second, e.g. titles or screens may scroll. It is up to the output driver to only update changed parts of the display.

     
  • Markus Dolze
    Markus Dolze
    2011-04-23

    • status: open --> closed-invalid