EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: epicsTimer and rounding
From: Andrew Johnson <[email protected]>
To: [email protected]
Date: Fri, 8 Jun 2012 14:07:51 -0500
Hi All,

Sorry if I confused anyone with my earlier post.

On 2012-06-08 Ralph Lange wrote:
> On 08.06.2012 18:56, Hill, Jeff wrote:
> > Actually my understanding is that Ralph is requesting two action items.
> >
> > 1) Remove the compensation in the epicsTimer class which subtracts one
> > half quantum from the timer's expiration time stamp. This is accepting
> > going to a new behavior where on average timers will expire one half tick
> > too late (the regression tests should verify this) but is presumably
> > needed because we prefer behavior where timers never expire as much as
> > one half tick too early (as is the case now).

This change sounds like it should occur in 3.15, so code can easily be written 
to compensate for the behavior change depending on macros on epicsVersion.h.

> > 2) Make all epicsThreadSleep implementations follow the application
> > developer's guide and implement epicsThreadSleep(double ss) as follows.
> >
> > ss <= 0.0                sleep for 0 ticks
> > 0 < ss <= 1 tick         sleep for 1 tick (typical actual delay between 1
> >                          and 2 ticks)
> > 1 tick < ss <= 2 tick    sleep for 2 ticks (typical actual delay between 2
> >                          and 3 ticks)
> > 2 tick < ss <= 3 tick    sleep for 3 ticks (typical actual delay between 3
> >                          and 4 ticks)

IMHO any changes necessary to implement this are bug fixes and should be 
committed to 3.14, since this is what the API was originally intended to do, 
although the current appDevGuide wording doesn't make that completely obvious:

http://www.aps.anl.gov/epics/base/R3-14/12-docs/AppDevGuide/node21.html#14439

Can any of the existing libCom tests or performance measurements be used to 
demonstrate what the epicsThreadSleep() code currently implements?  If not, it 
would be nice to have a test that fails when epicsThreadSleep() is not 
implementing the right behavior, if that is detectable.

> I do see the use case for a statistically improved timer, though.
> For this I like Kay's idea of allowing the C++ timer class user to
> select the behavior through the API.

No objections from here, that would be a 3.15 (or 3.16)-level change.  If you 
want it in 3.15 though it needs to be published within the next week.

- Andrew
-- 
Never interrupt your enemy when he is making a mistake.
-- Napoleon Bonaparte

References:
Re: epicsTimer and rounding Kasemir, Kay
RE: epicsTimer and rounding Hill, Jeff
Re: epicsTimer and rounding Ralph Lange

Navigate by Date:
Prev: Re: epicsTimer and rounding Eric Norum
Next: Re: "spinlock" API Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: epicsTimer and rounding Ralph Lange
Next: Re: epicsTimer and rounding Eric Norum
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 26 Nov 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·