From nobody Wed Nov 27 23:09:25 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 7A8C41E5732 for ; Mon, 18 Nov 2024 20:14:27 +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=1731960867; cv=none; b=MQab1JeGRTEfWeZTr9LWn27MHQ/foHmV65a91rhvwWDXy21QptWFs5vsbhdbiNJ5RNfMpXoPBwnhnW+eDFmxbPaflUdFttKKWinZg1n1epDy7aHZ3/pNzm+rSH6Vpw1lUA89pldViib2wptt6U9QX59dow30/i7uS+v1Y4txiaE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731960867; c=relaxed/simple; bh=EFXGenEvq+97XtCagTbKXm70xIu/0FQ5mQXGq+OYBUs=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=auV7VRcw94HIDs509Ghl3yX0NdvwwEhz6MP8t1wWRv1miJUi/HPWkT3eB3kMaX/akJQx4orf8iT85dTtUtG+6/8l3zfA8qD5gFcpTAXe4IkelzUyc9bCg+2SU6oHcz+3mDpezjkDooIDb0Tn9Nz6JuvTBikHOijL9SBVt/yhA2w= 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 47874C4CED8; Mon, 18 Nov 2024 20:14:27 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1tD89D-0000000D8y9-1rag; Mon, 18 Nov 2024 15:14:59 -0500 Message-ID: <20241118201459.296411856@goodmis.org> User-Agent: quilt/0.68 Date: Mon, 18 Nov 2024 15:14:34 -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/4] tools/rtla: Enhance argument parsing in timerlat_load.py References: <20241118201431.871648641@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