Skip to content

Commit

Permalink
tools/rtla: Improve code readability in timerlat_load.py
Browse files Browse the repository at this point in the history
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: "[email protected]" <[email protected]>
Cc: "[email protected]" <[email protected]>
Link: https://lore.kernel.org/j2B-ted7pv3TaldTyqfIHrMmjq2fVyBFgnu3TskiQJsyRzy9loPTVVJoqHnrCWu5T88MDIFc612jUglH6Sxkdg9LN-I1XuITmoL70uECmus=@protonmail.com
Signed-off-by: Furkan Onder <[email protected]>
Reviewed-by: Tomas Glozar <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
  • Loading branch information
furkanonder authored and rostedt committed Nov 19, 2024
1 parent fcbc60d commit fc5f5ae
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/tracing/rtla/sample/timerlat_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
exit(1)

try:
os.sched_setaffinity(0, affinity_mask);
os.sched_setaffinity(0, affinity_mask)
except:
print("Error setting affinity")
exit(1)

if (args.prio):
if args.prio:
try:
param = os.sched_param(int(args.prio))
os.sched_setscheduler(0, os.SCHED_FIFO, param)
Expand All @@ -51,21 +51,21 @@
exit(1)

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

try:
data_fd = open("/dev/full", 'r');
data_fd = open("/dev/full", 'r')
except:
print("Error opening data fd")

while True:
try:
timerlat_fd.read(1)
data_fd.read(20*1024*1024)
data_fd.read(20 * 1024 * 1024)
except:
print("Leaving")
break
Expand Down

0 comments on commit fc5f5ae

Please sign in to comment.