From patchwork Thu Dec 5 17:31:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Power, Ciara" X-Patchwork-Id: 63605 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2463DA04F2; Thu, 5 Dec 2019 18:34:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A8C451BF9A; Thu, 5 Dec 2019 18:34:16 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0521B1BF8B for ; Thu, 5 Dec 2019 18:34:12 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Dec 2019 09:34:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,282,1571727600"; d="scan'208";a="223711833" Received: from silpixa00399953.ir.intel.com (HELO silpixa00399953.ger.corp.intel.com) ([10.237.222.53]) by orsmga002.jf.intel.com with ESMTP; 05 Dec 2019 09:34:11 -0800 From: Ciara Power To: dev@dpdk.org Cc: Bruce Richardson , Ciara Power Date: Thu, 5 Dec 2019 17:31:25 +0000 Message-Id: <20191205173128.64543-4-ciara.power@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191205173128.64543-1-ciara.power@intel.com> References: <20191205173128.64543-1-ciara.power@intel.com> Subject: [dpdk-dev] [RFC 3/6] usertools: add process-info python script X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Bruce Richardson 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 Signed-off-by: Ciara Power --- 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)