Hi,
Thank you for your patch. First, Daniel is unfortunately no longer the maintainer of this code: https://lwn.net/Articles/979912/ This patch is not formatted correctly, so it can not even be reviewed. Please take a look at Submitting Patches: https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html -- Steve On Sat, 21 Sep 2024 23:43:02 +0000 furkanonder <[email protected]> wrote: > The enhancements made to timerlat_load.py focus on improving error handling, > readability, and overall user experience. These changes aim to make the > script more robust and easier to maintain while providing clearer feedback to > users. > Key modifications include: > > Type Declaration in Argument Parsing: > Added type declarations for command-line arguments in the argument parser. > This removes the need for manual type checks later in the code, improving > clarity and safety. > Before: > parser.add_argument("cpu", help='CPU to run timerlat thread') > parser.add_argument("-p", "--prio", help='FIFO priority') > After: > parser.add_argument("cpu", type=int, help='CPU to run timerlat thread') > parser.add_argument("-p", "--prio", type=int, help='FIFO priority') > > String Formatting: > Replaced string concatenation with an f-string to enhancing readability and > conciseness. > Before: > timerlat_path = "/sys/kernel/tracing/osnoise/per_cpu/cpu" + args.cpu + > "/timerlat_fd" > After: > timerlat_path = > f"/sys/kernel/tracing/osnoise/per_cpu/cpu{args.cpu}/timerlat_fd" > > Enhanced Exception Handling and Consistent Error Reporting: > Specific exceptions are now caught and printed with clearer messages, > providing context for errors when opening file descriptors. Added exception > handling for the data file descriptor opening to ensure uniformity across the > script. > > Before: > $ sudo python timerlat_load.py 122 > Error setting affinity > After: > $ sudo python timerlat_load.py 122 > Error setting affinity: [Errno 22] Invalid argument > > Before: > $ sudo python timerlat_load.py 1 -p 950 > Error setting priority > After: > $ sudo python timerlat_load.py 1 -p 950 > Error setting priority: [Errno 22] Invalid argument > > Before: > $ python timerlat_load.py 1 > Error opening timerlat fd, did you run timerlat -U? > After: > $ python timerlat_load.py 1 > Permission denied. Please check your access rights. > > Changes for the read Infinite Loop: > The original generic exception clause has been replaced with more specific > exception types to provide clearer feedback on errors.
