From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 47ACCA054F; Mon, 15 Feb 2021 17:08:35 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B7986160684; Mon, 15 Feb 2021 17:08:34 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 2C602406FF for ; Mon, 15 Feb 2021 17:08:32 +0100 (CET) IronPort-SDR: MbcVxbrUmaXzQ4XW9axPA9Z4hZS6CTOca4qiJ2OoPo+wL9/TN8QMiaGAZHp1LZZ/jap8ZIaFNa zVaiqwrJqusA== X-IronPort-AV: E=McAfee;i="6000,8403,9896"; a="182788711" X-IronPort-AV: E=Sophos;i="5.81,181,1610438400"; d="scan'208";a="182788711" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2021 08:08:31 -0800 IronPort-SDR: W7YpGyicblquowCEJdaFfI26N0ikEF5BRFZ6ZDj2Zo/bssWTjiZnalxET0tRgxy4zjXyk10f/P dS6ipLjZXaFw== X-IronPort-AV: E=Sophos;i="5.81,181,1610438400"; d="scan'208";a="399129252" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.3.54]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 15 Feb 2021 08:08:30 -0800 Date: Mon, 15 Feb 2021 16:08:26 +0000 From: Bruce Richardson To: Kevin Laatz Cc: dev@dpdk.org Message-ID: <20210215160826.GA255@bricha3-MOBL.ger.corp.intel.com> References: <20210215155051.8659-1-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210215155051.8659-1-kevin.laatz@intel.com> Subject: Re: [dpdk-dev] [PATCH] usertools/dpdk-telemetry: add file-prefix cmdline argument X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" On Mon, Feb 15, 2021 at 03:50:51PM +0000, Kevin Laatz wrote: > Currently the dpdk-telemetry.py script connects to all running DPDK apps > consecutively. With the addition of this file-prefix argument, we can limit > the amount of information returned providing improved consumability and > precision to the user. > > Signed-off-by: Kevin Laatz Couple of comments below. With those fixed, please add my reviewed and tested-by tags. This is a handy change when working with multiple DPDK processes simultaneously - in my case I tested with OVS and a testpmd instance using virtio-user connected to it. Reviewed-by: Bruce Richardson Tested-by: Bruce Richardson > --- > usertools/dpdk-telemetry.py | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py > index 181859658f..8cafcf74a6 100755 > --- a/usertools/dpdk-telemetry.py > +++ b/usertools/dpdk-telemetry.py > @@ -12,6 +12,7 @@ > import glob > import json > import readline > +import argparse > > # global vars > TELEMETRY_VERSION = "v2" > @@ -70,14 +71,20 @@ def readline_complete(text, state): > return matches[state] > > > +def get_dpdk_runtime_dir(fp): > + """ Get the DPDK runtime directory based on the file-prefix and user """ Add to this comment that the logic here matches that in EAL in DPDK itself. > + if (os.getuid() == 0): > + return "/var/run/dpdk/{}".format(fp) > + return "{}/dpdk/{}".format(os.environ.get('XDG_RUNTIME_DIR', '/tmp'), fp) > + > + > readline.parse_and_bind('tab: complete') > readline.set_completer(readline_complete) > readline.set_completer_delims(readline.get_completer_delims().replace('/', '')) > > -# Path to sockets for processes run as a root user > -for f in glob.glob('/var/run/dpdk/*/dpdk_telemetry.%s' % TELEMETRY_VERSION): > - handle_socket(f) > -# Path to sockets for processes run as a regular user > -for f in glob.glob('%s/dpdk/*/dpdk_telemetry.%s' % > - (os.environ.get('XDG_RUNTIME_DIR', '/tmp'), TELEMETRY_VERSION)): > - handle_socket(f) > +parser = argparse.ArgumentParser() > +parser.add_argument("-f", "--file_prefix", \ I think "file-prefix" with "-" rather than "_", again to match DPDK itself. > + help="Provide file_prefix for DPDK runtime directory", default="rte") > +args = parser.parse_args() > +rdir = get_dpdk_runtime_dir(args.file_prefix) > +handle_socket("{}/dpdk_telemetry.{}".format(rdir, TELEMETRY_VERSION)) > -- > 2.25.1 >