epicsThreadSleepQuantum() not accurate
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Triaged
|
Wishlist
|
Andrew Johnson |
Bug Description
epicsThreadSlee
Additional information:
Suggestion from J. Lewis Muir:
As a first step, I could see adding a function such as
void epicsThreadSetS
If someone knows what the sleep quantum should be for their particular machine (by experiment or otherwise), they can set it explicitly (at IOC boot time or whenever). If this function is never called, epicsThreadSlee
A step beyond this first step might not be a good idea. But if one was to try to implement a step 2 by tackling the problem of automatically determining the actual sleep quantum, perhaps a function could be added with this signature:
void epicsThreadCali
This function would use an algorithm to determine the actual sleep quantum and set it via step 1's epicsThreadSetS
What algorithm to use is where things might become difficult. I could see it being difficult to come up with an algorithm that would correctly determine a good actual sleep quantum for the wide range of hardware and operating systems on which EPICS runs.
Original Mantis Bug: mantis-324
http://
tags: | added: codeathon |
This is the sleep quantum result for 32 bit compatibility mode on windows vista 64. The result is different certainly compared to windows 2000 where the windows stubs were originally developed. MS may be allocating a hardware timer to schedule the wake up when one is available, or using a faster scheduling quantum?
testPriority main error expected from epicsThreadSetP riority ....... ..done ....... ..done pQuantum( ) call returns 0.015600 sec. dSelf () ateGet( ) takes 0.017555 microseconds
id 004321D0 old 49 new 49
testPriority thread
id 00432AD0 old 50 new 50
Estimating sleep quantum.
Estimating sleep quantum.
The epicsThreadSlee
This doesnt match the quantum estimate of 0.001149 sec within 10%.
It takes 0.030687 micro sec to call epicsThreadGetI
epicsThreadPriv