EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: DBE_PROPERTY events
From: Zimoch Dirk via Core-talk <core-talk at aps.anl.gov>
To: "anj at anl.gov" <anj at anl.gov>, "mdavidsaver at gmail.com" <mdavidsaver at gmail.com>
Cc: "core-talk at aps.anl.gov" <core-talk at aps.anl.gov>
Date: Fri, 30 Aug 2024 07:21:12 +0000
> This was an explicitly made technical shortcut to get this feature in.

OK. That relieves my concerns to change it. I was not sure if there was a
specific request to have that behavior, as it was prominently mentioned twice.

My current approach for property fields is to convert the value into a local
buffer (type epicsAny) and then compare the bytes with the old field content and
then copy if the value changed. This avoids to call the conversion function
twice at the cost of moving up to 40 bytes (but often less) from a local buffer
into the field.

This additional code path is only taken for property fields and only if monitors
are connected. Thus, it should not decrease the performance for non-property
fields. For property fields there is the additional work of comparing field_size
bytes with the old value. And in the case of a change to write the new value.

PR will follow soon.


On Thu, 2024-08-29 at 17:21 +0000, Johnson, Andrew N. wrote:
> On 8/29/24, 10:11 AM, Michael Davidsaver via Core Talk wrote:
>  
> On 8/29/24 06:20, Zimoch Dirk via Core-talk wrote:
> > Checking the EPICS base code, I found thus in dbPut():
> >      /* If this field is a property (metadata) field,
> >       * then post a property change event (even if the field
> >       * didn't change).
> >       */
> >      if (precord->mlis.count && pfldDes->prop)
> >          db_post_events(precord, NULL, DBE_PROPERTY);
> > 
> > So this behavior is on purpose, but I wonder why.
> 
> This was an explicitly made technical shortcut to get this feature in.
> 
> dbCore has no mechanism for previous value tracking, with this instead being left
> to individual record support to handle.  Doing otherwise would seem to require
> keeping a uniform previous value for every field, or eg. somehow encoding an
> association between value and previous value into the DBD.
> 
> The above code is inside the dbPut() routine that modifies the field being referred to, so earlier on it does have access to the old field value before the write happens, and to the new value after the write. Property fields (i.e. fields that have pfldDes->prop set to indicate they hold metadata) are all simple and can’t be arrays or double-buffered, so it might not be too hard to copy the old value before writing to it, then compare the new value afterwards to determine whether to post this change. The code that stores the old value and later compares it should only do those things for property fields when someone is monitoring this record (the condition in the if above), which should be a small overhead.
> 
> Thus I could see this as being possible, my analysis agrees with Dirk’s. I don’t have an objection to doing that as long as the measured performance isn’t significantly different.
> 
> - Andrew
> 
> -- 
> Complexity comes for free, Simplicity you have to work for.
>  

References:
DBE_PROPERTY events Zimoch Dirk via Core-talk
Re: DBE_PROPERTY events Michael Davidsaver via Core-talk
Re: DBE_PROPERTY events Johnson, Andrew N. via Core-talk

Navigate by Date:
Prev: Build failed: epics-base base-isnan_vs2022-62 AppVeyor via Core-talk
Next: Build failed: EPICS Base 7 base-7.0-1294 AppVeyor via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <20242025 
Navigate by Thread:
Prev: Re: DBE_PROPERTY events Johnson, Andrew N. via Core-talk
Next: Build failed: EPICS Base 7 base-7.0-1293 AppVeyor via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <20242025 
ANJ, 30 Aug 2024 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions ·
· Download · Search · IRMIS · Talk · Documents · Links · Licensing ·