Experimental Physics and Industrial Control System
|
Hi Dirk,
On 5/7/19 4:37 AM, Dirk Zimoch via Core-talk wrote:
I finally found some time to come back to the 'dbll' code. You described the new link methods, but I still have a question.
1. You wrote:
The following new routines in dbLink.h allow you to examine the link
support that is attached to a particular link field:
int dbLinkIsDefined(const struct link *plink); /* 0 or 1 */
int dbLinkIsConstant(const struct link *plink); /* 0 or 1 */
int dbLinkIsVolatile(const struct link *plink); /* 0 or 1 */
int dbIsLinkConnected(const struct link *plink); /* 0 or 1 */
The first one dbLinkIsDefined() tells you whether the field is attached
to a link support at all.
But to use them, I have to cast the field like ((DBLINK *)dbEntry.pfield) before I even know if it is a link at all, because the functions work on links, not on generic db fields. Can that be safe?
You should only pass those link routines a pointer to a link field. However the IOC has a list of the link fields in each record type and two routines dbGetNLinks() and dbGetLinkField() in dbStaticLib to get to those fields. If you look at the code for dbReportDeviceConfig()
you'll see them being used.
2. Also you mentioned the new "faster" way to get the links:
There is now a faster way to find all the DB links that point to a
particular record though, the dbDbLink.c code now keeps an ELList of
those links for the new lock-set code in dbLock.c to use.
This is true if I already have the record. But does it make a difference if I only have the record name (or a name pattern)? In that case I need iterate all records anyway. Only that this time I do it to find the target record(s) instead of the records with
links. So with n records it is O(n) in both cases.
Or is it so that 2 is actually the solution to 1?
Your current code iterates through every field (up to 269 depending on the record type) of every record instance in the IOC database, and for every link field (DB or CA) it performs a record-name lookup on the PV name in that link (which requires calculating
a hash of the name and checking the names in that hash bucket, which may have several records in it so does several string comparisons, most of which are going to fail).
If you use the new BKLNK field in the record you will still have to look through every record instance, but for each record you immediately know how many DB links point back to this record, which in most cases will be a small number or 0. Now this doesn't give
you CA links, and the order in which you will get results is going to be different because your primary scan is now by link target instead of by link source, but the work required to scan the list will be significantly reduced. Look at dbLock.c for how Michael
uses bklnk and dbDbLink.c for how it gets populated.
HTH,
- Andrew
--
Complexity comes for free, Simplicity you have to work for.
|
- Replies:
- Re: EPICS 7.0.2.1 release preparation Dirk Zimoch via Core-talk
- References:
- EPICS 7.0.2.1 release preparation Michael Davidsaver via Core-talk
- Re: EPICS 7.0.2.1 release preparation Dirk Zimoch via Core-talk
- Re: EPICS 7.0.2.1 release preparation Johnson, Andrew N. via Core-talk
- Re: EPICS 7.0.2.1 release preparation Dirk Zimoch via Core-talk
- Re: EPICS 7.0.2.1 release preparation Dirk Zimoch via Core-talk
- Navigate by Date:
- Prev:
Build completed: epics-base base-dbparser-cleanup-245 AppVeyor via Core-talk
- Next:
Re: EPICS 7.0.2.1 release preparation Dirk Zimoch 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
2024
- Navigate by Thread:
- Prev:
Re: EPICS 7.0.2.1 release preparation Dirk Zimoch via Core-talk
- Next:
Re: EPICS 7.0.2.1 release preparation Dirk Zimoch 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
2024
|
ANJ, 08 May 2019 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|