Re: [PATCH v1] rt-tests: hwlatdetect: Add --time-format argument

Costa Shulyupin <[email protected]> Sun, 26 Apr 2026 17:02:08 +0300
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <CADDUTFxHz4RzJ_QzjiuHKGi0=U3u_C=Nuong+gRn+ZN1KFA9Sw@mail.gmail.com>
On Wed, 15 Apr 2026 at 22:28, John Kacur <[email protected]> wrote:
> 2. There's no try/except around strftime(). If a user provides an invalid
>    format string, the code will crash. This should be handled gracefully.
Python's strftime doesn't crash on invalid format strings - unknown directives
like %Q are passed through literally. No try/except needed.

> 3. The use of a class variable for time_format is unconventional:
>
>        Tracer.Sample.time_format = args.time_format
>
>    While it works, this makes all Sample instances share state in a way that
>    could be surprising. Consider passing the format through instance
>    initialization or as a method parameter instead.
This surprises me. It's simpler to make `time_format` global or even
`args` itself.

Thank you,
Costa