DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ciara Power <ciara.power@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	Ciara Power <ciara.power@intel.com>
Subject: [dpdk-dev] [RFC 3/6] usertools: add process-info python script
Date: Thu,  5 Dec 2019 17:31:25 +0000	[thread overview]
Message-ID: <20191205173128.64543-4-ciara.power@intel.com> (raw)
In-Reply-To: <20191205173128.64543-1-ciara.power@intel.com>

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:app_params","/eal:params","/eal:version"]}

--> /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 --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)
-- 
2.17.1


  parent reply	other threads:[~2019-12-05 17:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-05 17:31 [dpdk-dev] [RFC 0/6] replace telemetry with process_info Ciara Power
2019-12-05 17:31 ` [dpdk-dev] [RFC 1/6] process-info: introduce process-info library Ciara Power
2019-12-05 17:31 ` [dpdk-dev] [RFC 2/6] eal: integrate " Ciara Power
2019-12-05 17:31 ` Ciara Power [this message]
2019-12-05 17:31 ` [dpdk-dev] [RFC 4/6] ethdev: add callback support for process-info Ciara Power
2019-12-05 17:31 ` [dpdk-dev] [RFC 5/6] rawdev: " Ciara Power
2019-12-05 17:31 ` [dpdk-dev] [RFC 6/6] examples/l3fwd-power: enable use of process-info Ciara Power
2020-02-05 15:21 ` [dpdk-dev] [RFC 0/6] replace telemetry with process_info David Marchand
2020-02-05 17:12   ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191205173128.64543-4-ciara.power@intel.com \
    --to=ciara.power@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).