From nobody Fri Nov 22 05:33:58 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69F821E8820 for ; Mon, 18 Nov 2024 21:41:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731966078; cv=none; b=aXgZ+TxiysLWsdg7J56DXSRTxeZAWy1iW27byGZouFpFtaeMWotx1N4sGDOhRNq4jOYwAJIe6UGG8n7ztGBD/py9QqqpqB5se3ZqkJlO4quq4P/78OHHG/z+lNOY5ROHkQHORk9Tb3sJ6N4zvN0zG4RdMc6IEyrccaH074anYys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731966078; c=relaxed/simple; bh=EFXGenEvq+97XtCagTbKXm70xIu/0FQ5mQXGq+OYBUs=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=uHEBGqS1QwXA+il9wGAPICg3a+iO3NnmpWPAgJV1MfD/jsiIZvlQCH9i+LbGI3JeHZexKGk5ig6Q0B68gGtHBLXxy+hI9WLHOIBL/t57Jpsj68SIMg51VaL1IOPrCzN33RGxiyX6nzfESHWr/x8cPbJccsAq+doEAjMmLjIeJns= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF0EFC4CED0; Mon, 18 Nov 2024 21:41:17 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1tD9VG-0000000DO56-0CoM; Mon, 18 Nov 2024 16:41:50 -0500 Message-ID: <20241118214149.900721438@goodmis.org> User-Agent: quilt/0.68 Date: Mon, 18 Nov 2024 16:41:25 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , "lgoncalv@redhat.com" , Furkan Onder Subject: [for-next][PATCH 3/5] tools/rtla: Enhance argument parsing in timerlat_load.py References: <20241118214122.136581969@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: furkanonder The enhancements made to timerlat_load.py are aimed at improving the clarit= y of argument parsing. Summary of Changes: - The cpu argument is now specified as an integer type in the argument parser to enforce input validation, and the construction of affinity_mask has been simplified to directly use the integer value of args.cpu. - The prio argument is similarly updated to be of integer type for consistency and validation, eliminating the need for the conversion of args.prio to an integer, as this is now handled by the argument parser. Cc: "jkacur@redhat.com" Cc: "lgoncalv@redhat.com" Link: https://lore.kernel.org/QfgO7ayKD9dsLk8_ZDebkAV0OF7wla7UmasbP9CBmui_s= ChOeizy512t3RqCHTjvQoUBUDP8dwEOVCdHQ5KvVNEiP69CynMY94SFDERWl94=3D@protonmai= l.com Signed-off-by: Furkan Onder Reviewed-by: Tomas Glozar Signed-off-by: Steven Rostedt (Google) --- tools/tracing/rtla/sample/timerlat_load.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/tracing/rtla/sample/timerlat_load.py b/tools/tracing/rtl= a/sample/timerlat_load.py index 785e9a83539a..d7341ed5127a 100644 --- a/tools/tracing/rtla/sample/timerlat_load.py +++ b/tools/tracing/rtla/sample/timerlat_load.py @@ -25,13 +25,12 @@ import sys import os =20 parser =3D argparse.ArgumentParser(description=3D'user-space timerlat thre= ad in Python') -parser.add_argument("cpu", help=3D'CPU to run timerlat thread') -parser.add_argument("-p", "--prio", help=3D'FIFO priority') - +parser.add_argument("cpu", type=3Dint, help=3D'CPU to run timerlat thread') +parser.add_argument("-p", "--prio", type=3Dint, help=3D'FIFO priority') args =3D parser.parse_args() =20 try: - affinity_mask =3D { int(args.cpu) } + affinity_mask =3D {args.cpu} except: print("Invalid cpu: " + args.cpu) exit(1) @@ -44,7 +43,7 @@ except: =20 if args.prio: try: - param =3D os.sched_param(int(args.prio)) + param =3D os.sched_param(args.prio) os.sched_setscheduler(0, os.SCHED_FIFO, param) except: print("Error setting priority") --=20 2.45.2