From nobody Fri Nov 22 02:31:08 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 ECA541E7643 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=bMhuIHuu1KC5BUrsc3YsVBdM4h4IIqfduBO5kCzH0IU/9R4p8ZvexDBIO87pSO7NGGeduV0v8fK0dQBmPD+79nftOdJJD8zTEc9BAvg/JkEbNSYlfALmpmBXiWMLe/82BH7Hgv9yLPSXfHyWV4t9p673J+oUGps5vg8EEEmCw9w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731966078; c=relaxed/simple; bh=9vh/n3TLJf6SPuh2A+56vcj5XMn/yl800FwblNP07pY=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=sbg1m/fLN+fpC3g8CG0Pt3iOa7V8L9FipcdYdIRmLjxKfQP7lpOvZN2p2mVVxHecvK09iFuDwR9+JYmh6ghy+FGKW1kW96VHG/dU7a3gOQPrBWajRNBDfdwFr6i8InWds2x2qMVQeq60FP+SJzr69aUZ4W3EL3sE3tb08KL+4+M= 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 90C25C4CED6; Mon, 18 Nov 2024 21:41:17 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1tD9VF-0000000DO4b-3hP6; Mon, 18 Nov 2024 16:41:49 -0500 Message-ID: <20241118214149.736470998@goodmis.org> User-Agent: quilt/0.68 Date: Mon, 18 Nov 2024 16:41:24 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , "lgoncalv@redhat.com" , Furkan Onder Subject: [for-next][PATCH 2/5] tools/rtla: Improve code readability 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 intended to improve the script's robustness and readability. Summary of the changes: - Unnecessary semicolons at the end of lines have been removed. - Parentheses surrounding the if statement checking args.prio have been eliminated. - String concatenation for constructing timerlat_path has been replaced with an f-string. - Spacing in a multiplication expression has been adjusted for improved clarity. Cc: "jkacur@redhat.com" Cc: "lgoncalv@redhat.com" Link: https://lore.kernel.org/j2B-ted7pv3TaldTyqfIHrMmjq2fVyBFgnu3TskiQJsyR= zy9loPTVVJoqHnrCWu5T88MDIFc612jUglH6Sxkdg9LN-I1XuITmoL70uECmus=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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/tracing/rtla/sample/timerlat_load.py b/tools/tracing/rtl= a/sample/timerlat_load.py index 8cc5eb2d2e69..785e9a83539a 100644 --- a/tools/tracing/rtla/sample/timerlat_load.py +++ b/tools/tracing/rtla/sample/timerlat_load.py @@ -37,12 +37,12 @@ except: exit(1) =20 try: - os.sched_setaffinity(0, affinity_mask); + os.sched_setaffinity(0, affinity_mask) except: print("Error setting affinity") exit(1) =20 -if (args.prio): +if args.prio: try: param =3D os.sched_param(int(args.prio)) os.sched_setscheduler(0, os.SCHED_FIFO, param) @@ -51,21 +51,21 @@ if (args.prio): exit(1) =20 try: - timerlat_path =3D "/sys/kernel/tracing/osnoise/per_cpu/cpu" + args.cpu= + "/timerlat_fd" + timerlat_path =3D f"/sys/kernel/tracing/osnoise/per_cpu/cpu{args.cpu}/= timerlat_fd" timerlat_fd =3D open(timerlat_path, 'r') except: print("Error opening timerlat fd, did you run timerlat -U?") exit(1) =20 try: - data_fd =3D open("/dev/full", 'r'); + data_fd =3D open("/dev/full", 'r') except: print("Error opening data fd") =20 while True: try: timerlat_fd.read(1) - data_fd.read(20*1024*1024) + data_fd.read(20 * 1024 * 1024) except: print("Leaving") break --=20 2.45.2