Yet another <quicker> way to determine which host wrote to a PV:
1) Load a subroutine record into the IOC using the code below
2) Include this subroutine record in the record processing chain of the record you want to monitor. You can use a FLNK or SDIS for this (make sure that it is *not* a CA or CP link).
When the record processes, you see something like this ...
ioclic1> caHostId: ioclic1:caHostId1: nda from chiron
We have a few of these subroutine records in all IOCs, so if we need to track down an errant "write" we can just change a few links ... without rebooting.
Ned
RECORD
record(sub,"$(IOC):caHostId1") {
field(INAM,"caHostIdI")
field(SNAM,"caHostId")
}
SUBROUTINE
/* subroutine for determining host/uid of CA client
*
* DESC : String identifying Username & Host
*
*/
#include <stdio.h>
#include <string.h>
#include <dbEvent.h>
#include <osiSock.h>
#include <ellLib.h>
#include <server.h>
#include <dbDefs.h>
#include <registryFunction.h>
#include <subRecord.h>
#include <epicsExport.h>
static long caHostIdI(subRecord* pr)
{
return(0);
}
static long caHostId(subRecord* pr)
{
char result[100];
epicsThreadId tid = epicsThreadGetIdSelf();
struct client* pclient;
LOCK_CLIENTQ;
for(pclient=(struct client*)ellFirst(&clientQ);
pclient && pclient->tid!=tid;
pclient=(struct client*)ellNext(&pclient->node)
);
if(pclient)
sprintf(result,"%s from %s",pclient->pUserName,pclient->pHostName);
else
sprintf(result,"Internal: TID = %p",tid);
UNLOCK_CLIENTQ;
strncpy(pr->desc, result, sizeof(pr->desc));
pr->desc[sizeof(pr->desc)-1] = '\0';
db_post_events(pr, pr->desc, 1);
pr->val = pr->a; /* set val to value of Input A */
printf("caHostId: %s: %s\n",pr->name,result);
return(0);
}
static registryFunctionRef caHostIdRef[] = {
{"caHostIdI",(REGISTRYFUNCTION)caHostIdI},
{"caHostId",(REGISTRYFUNCTION)caHostId}
};
static void caHostIdRegister(void)
{
registryFunctionRefAdd(caHostIdRef,NELEMENTS(caHostIdRef));
}
epicsExportRegistrar(caHostIdRegister);
________________________________________
From: [email protected] [[email protected]] on behalf of LEI Ge [[email protected]]
Sent: Wednesday, May 21, 2014 03:54 AM
To: [email protected]
Subject: how to know which PVs write to a PV
Hi, all,
This week we met a problem, a PV's value should be 1 (to enable our e-gun trigger), but sometimes it becomes 0 unexpectedly. I checked the software logic I can remember to this pv, and have not found the reason. Maybe there is some logic I forget or I don't know, to write to this pv. So is there a way to check in our control system, which PVs write to this pv? Or, this PV is written from which IP?
Thanks a lot ,
Ge
- Replies:
- RE: how to know which PVs write to a PV Hu, Yong
- References:
- how to know which PVs write to a PV LEI Ge
- Navigate by Date:
- Prev:
RE: Portable Channel Access Server Event Queue Christopher J. Pendleton
- Next:
RE: Interest in an Ethernet version of the SIS3820? Mark Rivers
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
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: Re: how to know which PVs write to a PV LEI Ge
- Next:
RE: how to know which PVs write to a PV Hu, Yong
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|