Skip to content

Commit fc5f5ae

Browse files
furkanonderrostedt
authored andcommitted
tools/rtla: Improve code readability in timerlat_load.py
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" <jkacur@redhat.com> Cc: "lgoncalv@redhat.com" <lgoncalv@redhat.com> Link: https://lore.kernel.org/j2B-ted7pv3TaldTyqfIHrMmjq2fVyBFgnu3TskiQJsyRzy9loPTVVJoqHnrCWu5T88MDIFc612jUglH6Sxkdg9LN-I1XuITmoL70uECmus=@protonmail.com Signed-off-by: Furkan Onder <furkanonder@protonmail.com> Reviewed-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent fcbc60d commit fc5f5ae

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/tracing/rtla/sample/timerlat_load.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
exit(1)
3838

3939
try:
40-
os.sched_setaffinity(0, affinity_mask);
40+
os.sched_setaffinity(0, affinity_mask)
4141
except:
4242
print("Error setting affinity")
4343
exit(1)
4444

45-
if (args.prio):
45+
if args.prio:
4646
try:
4747
param = os.sched_param(int(args.prio))
4848
os.sched_setscheduler(0, os.SCHED_FIFO, param)
@@ -51,21 +51,21 @@
5151
exit(1)
5252

5353
try:
54-
timerlat_path = "/sys/kernel/tracing/osnoise/per_cpu/cpu" + args.cpu + "/timerlat_fd"
54+
timerlat_path = f"/sys/kernel/tracing/osnoise/per_cpu/cpu{args.cpu}/timerlat_fd"
5555
timerlat_fd = open(timerlat_path, 'r')
5656
except:
5757
print("Error opening timerlat fd, did you run timerlat -U?")
5858
exit(1)
5959

6060
try:
61-
data_fd = open("/dev/full", 'r');
61+
data_fd = open("/dev/full", 'r')
6262
except:
6363
print("Error opening data fd")
6464

6565
while True:
6666
try:
6767
timerlat_fd.read(1)
68-
data_fd.read(20*1024*1024)
68+
data_fd.read(20 * 1024 * 1024)
6969
except:
7070
print("Leaving")
7171
break

0 commit comments

Comments
 (0)