[RFC,3/6] usertools: add process-info python script
diff mbox series

Message ID 20191205173128.64543-4-ciara.power@intel.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
  • replace telemetry with process_info
Related show


Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Power, Ciara Dec. 5, 2019, 5:31 p.m. UTC
From: Bruce Richardson <bruce.richardson@intel.com>

This patch adds a python script that can be used with the process_info
library. It connects as a client to the process_info socket, and allows
the user send a command and see the JSON response.

The example usage below shows the script connecting to the process_info
socket, and sending two basic commands entered by the user. The response
for each command is shown below the user input.

Connecting to /var/run/dpdk/rte/process_info.22103
--> /

--> /eal:version
{"/eal:version":"DPDK 20.02.0-rc0"}

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
 usertools/test_new_telemetry.py | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100755 usertools/test_new_telemetry.py

diff mbox series

diff --git a/usertools/test_new_telemetry.py b/usertools/test_new_telemetry.py
new file mode 100755
index 000000000..84243ffae
--- /dev/null
+++ b/usertools/test_new_telemetry.py
@@ -0,0 +1,28 @@ 
+#! /usr/bin/python3
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+import socket
+import os
+import sys
+import time
+import glob
+def handle_socket(path):
+    print("Connecting to " + path)
+    try:
+        fd.connect(path)
+    except OSError:
+        return
+    text = input('--> ')
+    while (text != "quit"):
+        fd.send(text.encode())
+        print(fd.recv(4096).decode())
+        text = input('--> ')
+    fd.close()
+fd = socket.socket(socket.AF_UNIX, socket.SOCK_SEQPACKET)
+for f in glob.glob('/var/run/dpdk/*/process_info.*'):
+  handle_socket(f)
+for f in glob.glob('/run/user/%d/dpdk/*/process_info.*' % os.getuid()):
+  handle_socket(f)