EPICS Home

Experimental Physics and Industrial Control System


 
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  <20192020  2021  2022  2023  2024  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  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Usage of pvlist
From: "Johnson, Andrew N. via Tech-talk" <[email protected]>
To: "[email protected]" <[email protected]>
Date: Wed, 3 Jul 2019 19:49:08 +0000
On 7/3/19 10:10 AM, Shen, Guobao via Tech-talk wrote:

I am trying to use pvlist to discover all PVs served thru pvAccess.

Let’s say that I have a few soft EPICS7 IOC running on one machine on different ports, for example:

$ pvlist

GUID 0xA21BC25C0000000083EAFA2C, version 1: tcp@[192.168.10.20:60605]

GUID 0xBA1BC25C00000000ACD90824, version 1: tcp@[192.168.10.20:60607]

GUID 0xBBB91C5D000000005646DE0A, version 1: tcp@[192.168.10.20:58861]

GUID 0xD71BC25C00000000E55F910B, version 1: tcp@[192.168.10.20:60608]

 

I can use pvlist IP:port to get the PVs served thru QSRV on that specific port.

If I use “pvlist IP”, it gives me the PVs only on the first port it found (looks like).

 

Is that a way to find all PVs on different ports instead of looping thru all ports individually?

The code for the pvlist program has the ability to query multiple servers in a single run (provided you explicitly list the servers), but the loop to do so is currently disabled so it stops after printing the first list of PVs that it successfully retrieves.

It is straightforward to re-enable the loop, which lets you give a list of GUIDs or IP:port numbers on the command-line to be queried. That requires applying this change to modules/pvAccess:
diff --git a/pvtoolsSrc/pvlist.cpp b/pvtoolsSrc/pvlist.cpp
index dc6a029..58d2b45 100644
--- a/pvtoolsSrc/pvlist.cpp
+++ b/pvtoolsSrc/pvlist.cpp
@@ -702,11 +702,10 @@ int main (int argc, char *argv[])
                 std::copy(val.begin(),
                           val.end(),
                           std::ostream_iterator<std::string>(std::cout, "\n"));
-
-                return allOK ? 0 : 1;
             }
-
-            std::cout<<ret<<"\n";
+            else {
+                std::cout<<ret<<"\n";
+            }
         }
     }
 

With that change in place, one way to list all visible PVA PVs is this shell one-liner:
tux% pvlist `pvlist | awk '{print $2}'`
C2:SIM7:Pva1:Image
C2:SIM8:Pva1:Image
C2:CTLS:Scope:Data
C2:SIM9:Pva1:Image

It runs pvlist twice, once to get the GUIDs and then again to get the PV names. This could be dangerous since it would be easy to overload a network with a large number of PVA servers, but the equivalent one-liner without the loop inside pvlist is this (which runs pvlist as many times as you have active PVA servers plus one and is somewhat slower):
tux% pvlist | awk '{print $2}' | xargs -L 1 pvlist
C2:SIM7:Pva1:Image
C2:SIM8:Pva1:Image
C2:CTLS:Scope:Data
C2:SIM9:Pva1:Image

I thus don't see a strong reason to not enable the loop by applying the above change.

- Andrew
-- 
Complexity comes for free, Simplicity you have to work for.

Replies:
Re: Usage of pvlist Shen, Guobao via Tech-talk
References:
Usage of pvlist Shen, Guobao via Tech-talk

Navigate by Date:
Prev: Re: epics performance test tools or results Jeong Han Lee via Tech-talk
Next: Re: Fwd: cross-compiling (kind of) with Buildroot Pierrick M Hanlet via Tech-talk
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  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Usage of pvlist Shen, Guobao via Tech-talk
Next: Re: Usage of pvlist Shen, Guobao via Tech-talk
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  <20192020  2021  2022  2023  2024