[v6,4/5] usertools/dpdk-telemetry: connect to in-memory processes

Message ID 20211005135909.726091-5-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series improve telemetry support with in-memory mode |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson Oct. 5, 2021, 1:59 p.m. UTC
  Allow connecting to an in-memory process via "-p <pid>" flag, which can
be used to identify the in-memory process to which to connect.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 doc/guides/howto/telemetry.rst | 6 ++++++
 usertools/dpdk-telemetry.py    | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
  

Comments

Conor Walsh Oct. 5, 2021, 3:19 p.m. UTC | #1
On 05/10/2021 14:59, Bruce Richardson wrote:
> Allow connecting to an in-memory process via "-p <pid>" flag, which can
> be used to identify the in-memory process to which to connect.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

Tested-by: Conor Walsh <conor.walsh@intel.com>
  

Patch

diff --git a/doc/guides/howto/telemetry.rst b/doc/guides/howto/telemetry.rst
index 8a61302459..c3adca9504 100644
--- a/doc/guides/howto/telemetry.rst
+++ b/doc/guides/howto/telemetry.rst
@@ -63,6 +63,12 @@  and query information using the telemetry client python script.
 
       ./usertools/dpdk-telemetry.py
 
+   .. note::
+
+     When connecting to a process run with `--in-memory` EAL flag,
+     one must specify the PID of the process to connect to using the `-p` flag.
+     This is because there may be multiple such instances.
+
 #. When connected, the script displays the following, waiting for user input::
 
      Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py
index 2974a64732..690014ba9a 100755
--- a/usertools/dpdk-telemetry.py
+++ b/usertools/dpdk-telemetry.py
@@ -112,6 +112,11 @@  def get_dpdk_runtime_dir(fp):
 parser = argparse.ArgumentParser()
 parser.add_argument('-f', '--file-prefix', default='rte',
                     help='Provide file-prefix for DPDK runtime directory')
+parser.add_argument('-p', '--pid',
+                    help='Connect to DPDK process with the given pid')
 args = parser.parse_args()
 rd = get_dpdk_runtime_dir(args.file_prefix)
-handle_socket(os.path.join(rd, 'dpdk_telemetry.{}'.format(TELEMETRY_VERSION)))
+sock_path = os.path.join(rd, 'dpdk_telemetry.{}'.format(TELEMETRY_VERSION))
+if args.pid:
+    sock_path += ".{}".format(args.pid)
+handle_socket(sock_path)