From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF6D0D46612 for ; Thu, 15 Jan 2026 19:04:05 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B21042D27; Thu, 15 Jan 2026 20:03:43 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by mails.dpdk.org (Postfix) with ESMTP id 5613C427B5 for ; Thu, 15 Jan 2026 20:03:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1768503820; x=1800039820; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XuRCpi4VIF7xehZkOq4unFuXzYQUlTSceE4Wa2Fj/Dg=; b=Pwv8BgVluoXXQO/XkKUGSd0KY2Zy1NbQScFvuwe5DPEor/jtNEsfG+D8 Oi4nJB0rNAnz8I6UIOLTYTWj6xfjXLxhs4yQuAIlXhL0kiXKgrkzIt9+h QZXSPuQskFK5IftWMCjLk+3al1zKNEtAfhKzwpUB6ms7+yHMbfQeeZWt3 HZ0z6AzJQcUyTcUA4NDU2YdsDiQ1usoFrkcvU/mvBp7BsXxEEP2b3anme g9QwhfkKpfAWtsL6lCxg4DkyyiZ/g+Ql2VTRoHttzd/ekKsdYblbSefof 5pqPwD+M4HrxMCtuDUiA/0hkg0tZDTU7jMXxPst6BX/2xzDPrNU387KUg Q==; X-CSE-ConnectionGUID: zZ9AivRSTTGL7bFTdiq37A== X-CSE-MsgGUID: R5/tYdHxSfuEn4dzFM9rrA== X-IronPort-AV: E=McAfee;i="6800,10657,11672"; a="80461399" X-IronPort-AV: E=Sophos;i="6.21,229,1763452800"; d="scan'208";a="80461399" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2026 11:03:39 -0800 X-CSE-ConnectionGUID: P94jbxHqTrKBv4gSRURSAg== X-CSE-MsgGUID: YAy+2Gb2Sju74QGqmdHQsw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,229,1763452800"; d="scan'208";a="205307684" Received: from silpixa00401385.ir.intel.com ([10.20.224.226]) by fmviesa008.fm.intel.com with ESMTP; 15 Jan 2026 11:03:38 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Stephen Hemminger Subject: [PATCH v3 4/7] usertools/telemetry-watcher: add total and one-line opts Date: Thu, 15 Jan 2026 19:03:28 +0000 Message-ID: <20260115190331.3721281-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260115190331.3721281-1-bruce.richardson@intel.com> References: <20251210165532.103450-1-bruce.richardson@intel.com> <20260115190331.3721281-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Add options to the script to print out totals at the end of each line, and to print each line replacing the previous one, saving the output scrolling up the screen constantly. Signed-off-by: Bruce Richardson Acked-by: Stephen Hemminger --- doc/guides/tools/telemetrywatcher.rst | 27 +++++++++++++++++++++++++++ usertools/dpdk-telemetry-watcher.py | 27 ++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/doc/guides/tools/telemetrywatcher.rst b/doc/guides/tools/telemetrywatcher.rst index 137a4803b2..3d22818260 100644 --- a/doc/guides/tools/telemetrywatcher.rst +++ b/doc/guides/tools/telemetrywatcher.rst @@ -56,6 +56,15 @@ Options This shows the change in statistics since the last iteration, which is useful for monitoring rates of change. +.. option:: -T, --total + + Display a total column at the end of each row that sums all monitored statistics. + +.. option:: -1, --single-line + + Display output on a single line, replacing the previous output. + This is useful for reducing scrolling and keeping the display compact. + .. option:: stat Statistics to monitor in format ``command.field``. @@ -107,6 +116,24 @@ List all running DPDK applications:: dpdk-telemetry-watcher.py -l +Output Format +------------- + +The tool displays statistics in a tabular format with: + +* **Time column** - Current timestamp (HH:MM:SS) +* **Statistics columns** - One column per specified statistic +* **Total column** - Optional sum of all statistics (when ``-T`` is used) + +Values are formatted with locale-specific number formatting (e.g., comma separators). + +When ``--delta`` mode is enabled, the tool displays the change in each statistic +since the last iteration, which typically represents the rate per second. + +When ``--single-line`` mode is enabled, each new output line replaces the previous one, +similar to tools like ``top``. + + Dependencies ------------ diff --git a/usertools/dpdk-telemetry-watcher.py b/usertools/dpdk-telemetry-watcher.py index 5f4aa05431..e4cd292515 100755 --- a/usertools/dpdk-telemetry-watcher.py +++ b/usertools/dpdk-telemetry-watcher.py @@ -210,10 +210,13 @@ def monitor_stats(process, args): header = "Time".ljust(10) for spec, _, _ in parsed_specs: header += spec.rjust(25) + if args.total: + header += "Total".rjust(25) print(header) # Monitor loop - once per second count = 0 + line_ending = "\r" if args.single_line else "\n" try: while args.timeout is None or count < args.timeout: time.sleep(1) @@ -223,6 +226,7 @@ def monitor_stats(process, args): row = timestamp.ljust(10) current_values = [] + total = 0 for i, (spec, command, field) in enumerate(parsed_specs): data = query_telemetry(process, command) current_value = data[field] @@ -233,11 +237,17 @@ def monitor_stats(process, args): else: display_value = current_value + total += display_value row += str(display_value).rjust(25) - print(row) + if args.total: + row += str(total).rjust(25) + + print(row, end=line_ending, flush=True) prev_values = current_values except KeyboardInterrupt: + if args.single_line: + print() # Add newline before exit message print("\nMonitoring stopped") @@ -282,6 +292,21 @@ def main(): default=False, help="Display delta values instead of absolute values", ) + parser.add_argument( + "-T", + "--total", + action="store_true", + default=False, + help="Display a total column at the end of each row", + ) + parser.add_argument( + "-1", + "--single-line", + action="store_true", + default=False, + dest="single_line", + help="Display output on a single line, replacing the previous output", + ) parser.add_argument( "stats", nargs="*", -- 2.51.0