public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Costa Shulyupin <costa.shul@redhat.com>
Cc: linux-rt-users@vger.kernel.org,
	"Luis Claudio R . Goncalves" <lgoncalv@redhat.com>
Subject: Re: [PATCH v1] rt-tests: hwlatdetect: Add --time-format argument
Date: Wed, 15 Apr 2026 15:27:29 -0400	[thread overview]
Message-ID: <20260415192729.175250-1-jkacur@redhat.com> (raw)
In-Reply-To: <20260323160346.230639-1-costa.shul@redhat.com>

On Mon, 23 Mar 2026 at 18:03:46 +0200, Costa Shulyupin wrote:
> Add --time-format argument to customize timestamp output format using
> strftime directives. By default raw timestamps are output for
> backward compatibility.

Hi Costa,

Thanks for this patch. The --time-format feature is useful, but I have a few
concerns about the implementation:

1. The format_timestamp() method assumes the timestamp always contains a
   decimal point:

       t, ns = self.timestamp.split('.')

   This will fail with ValueError if the timestamp doesn't have a '.' for
   any reason. Please add error handling.

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.

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.

4. Minor: The comment about "Float precision is safe for microseconds until
   year 2242" is misleading. The issue is that datetime only supports
   microsecond precision, not nanoseconds, which is why the custom %n
   handling is needed.

Could you please send a v2 with these improvements?

Thanks,
John

      reply	other threads:[~2026-04-15 19:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 16:03 [PATCH v1] rt-tests: hwlatdetect: Add --time-format argument Costa Shulyupin
2026-04-15 19:27 ` John Kacur [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260415192729.175250-1-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=costa.shul@redhat.com \
    --cc=lgoncalv@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox