Periodic scan thread delays are not accurate
Bug #597054 reported by
Andrew Johnson
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Fix Released
|
Low
|
Andrew Johnson |
Bug Description
Steve Hunt reported:
I notice that under Linux my (for instance) 1Hz scans are not at 1Hz, or at least that is what the timestamps say. It seems to gain 1ms or so each time it processes!!
Of course under VxWorks all is fine.
Related branches
Changed in epics-base: | |
assignee: | nobody → Andrew Johnson (anj) |
Changed in epics-base: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
This is probably something to do with the way that we implement the periodic scan threads using timers (by "gain" I assume the scan periods are slightly too long, not too short). We do subtract the time it takes to process all the records from the timer delay, but the result still has to be quantized and I'm pretty sure that the pthread_ cond_timedwait( ) that this eventually calls on Linux only has to guarantee to delay for that minimum time interval and is likely to wait for longer than requested. It looks like we do *not* adjust for the overhead associated with calculating the delay though, so it should be possible to be more accurate by enhancing the periodicTask() routine in dbScan.c by measuring that overhead as well.