Re: LCDd Command/Display Latency
Martin T Jones <[email protected]> Fri, 15 Jun 2012 16:51:45 +0100
| Newsgroups | gmane.comp.sysutils.lcdproc |
|---|---|
| Message-ID | <[email protected]> |
On 14/06/12 19:20, Caylan Van Larson wrote: > On Jun 14, 2012, at 9:23 AM, Martin T Jones wrote: > >> On 13/06/12 22:59, Caylan Van Larson wrote: >>> >>> The speed I'm seeing with libusb-1.0 is definitely faster. One out >>> of every 20 commands I send are displayed immediately. However, >>> most of the time the display lags about .5 seconds, up to one second >>> later. This lack of real-time response makes a user-interface >>> difficult to use. I've tested my code and it is definitely in the >>> display (not in the key press). >>> Is there a way to tighten the main.c loop by way of main.h >>> constants? I understand that tightening the loop is at the expense >>> of CPU cycles... how fast can I reasonably push it? >>> >>>> /* You should be able to modify the following freqencies... */ >>>> #define RENDER_FREQ 8 >>>> /* We want 8 frames per second */ >>>> #define PROCESS_FREQ 32 >>>> /* And 32 times per second processing of messages and keypresses. */ >> My system is complied with a higher process frequency (#define >> PROCESS_FREQ 100) which is needed to handle the IR receiver data in >> time but I don't remember a problem at the standard value. >> >> I've just done a quick test and the slowest (client_set -name >> example) is just over 30ms. >> >> martin@Ace:~$ socat -vlu STDIO,ignoreeof TCP4:LiFi.local:13666 >> 2>picoLCD.log >> >> > 2012/06/14 14:45:54.881604 length=6 from=0 to=5 >> hello >> < 2012/06/14 14:45:54.889096 length=73 from=0 to=72 >> connect LCDproc 0.5dev protocol 0.3 lcd wid 20 hgt 2 cellwid 5 cellhgt 8 >> > 2012/06/14 14:46:21.853583 length=25 from=6 to=30 >> client_set -name example >> < 2012/06/14 14:46:21.884362 length=8 from=73 to=80 >> success >> > 2012/06/14 14:46:32.133078 length=19 from=31 to=49 >> screen_add example >> < 2012/06/14 14:46:32.137076 length=8 from=81 to=88 >> success >> > 2012/06/14 14:46:47.861075 length=27 from=50 to=76 >> client_add_key -shared F1 >> < 2012/06/14 14:46:47.864711 length=8 from=89 to=96 >> success >> > 2012/06/14 14:47:12.741589 length=38 from=77 to=114 >> widget_add example exampleTitle title >> < 2012/06/14 14:47:12.747946 length=8 from=97 to=104 >> success >> > 2012/06/14 14:47:20.717590 length=48 from=115 to=162 >> widget_set example exampleTitle "Example Title" >> < 2012/06/14 14:47:20.736064 length=8 from=105 to=112 >> success >> > 2012/06/14 14:47:46.509084 length=27 from=163 to=189 >> widget_add example i1 icon >> < 2012/06/14 14:47:46.522206 length=8 from=113 to=120 >> success >> > 2012/06/14 14:47:58.929076 length=31 from=190 to=220 >> widget_set example i1 1 2 prev >> < 2012/06/14 14:47:58.933163 length=8 from=121 to=128 >> success >> < 2012/06/14 14:48:15.196001 length=15 from=129 to=143 >> listen example >> > 2012/06/14 14:53:16.309597 length=32 from=221 to=252 >> widget_add example line1 string >> < 2012/06/14 14:53:16.314173 length=8 from=144 to=151 >> success >> > 2012/06/14 14:53:26.605096 length=32 from=253 to=284 >> widget_add example line2 string >> < 2012/06/14 14:53:26.634674 length=8 from=152 to=159 >> success >> > 2012/06/14 14:53:33.693094 length=46 from=285 to=330 >> widget_set example line1 1 1 "Testing Line 1" >> < 2012/06/14 14:53:33.696917 length=8 from=160 to=167 >> success >> > 2012/06/14 14:53:39.429598 length=46 from=331 to=376 >> widget_set example line2 1 2 "Testing Line 2" >> < 2012/06/14 14:53:39.436049 length=8 from=168 to=175 >> success > > More debugging from my end. > > < 2012/06/14 13:19:39.104789 length=7 from=336 to=342 > key F1 > > 2012/06/14 13:19:40.105947 length=146 from=993 to=1138 > widget_set picolcd line1 1 1 "CoPOS - Status " > widget_set picolcd line2 1 2 "Up/Down to Choose >" > screen_set picolcd -backlight on > output 3 > < 2012/06/14 13:19:40.109371 length=32 from=343 to=374 > success > success > success > success > > Hrmm... so maybe not socat? > > Caylan I've had a more detailed look at the LCDd response times on my system and they are mostly random values up to 10ms, as one would expect with 100Hz process frequency (#define PROCESS_FREQ 100). The problem is the design of do_mainloop(void) in server/main.c. The sockets are polled in sock_poll_clients(); (select() with zero time-out), the required processing is performed then LCDd *sleeps* until the next processing slot (usleep(sleeptime);). Ideally there should be a single select() with a time-out appropriate for the time based processing (polling of some keypads and scrolling of those widgets that support it), all other processing should be as required. Unfortunately that is not a trivial change. Martin _______________________________________________ LCDproc mailing list [email protected] http://lists.omnipotent.net/mailman/listinfo/lcdproc