From: Peter Senna Tschudin <peter.senna@linux.intel.com>
To: igt-dev@lists.freedesktop.org,
Kamil Konieczny <kamil.konieczny@linux.intel.com>
Subject: Re: [PATCH i-g-t v1 1/1] runner/executor: Use bootime for time checks
Date: Wed, 2 Apr 2025 13:15:47 +0200 [thread overview]
Message-ID: <8e72dab2-1bb0-41c4-8a1d-d409689cd61c@linux.intel.com> (raw)
In-Reply-To: <20250328163342.119140-2-kamil.konieczny@linux.intel.com>
Hi Kamil,
On 3/28/2025 5:33 PM, Kamil Konieczny wrote:
> Runner is printing time to stdout/stderr with CLOCK_BOOTTIME but
> when measuring time for a test it is using an igt library which
> uses CLOCK_MONOTONIC. This leads to an errors when calculating
> time left for tests using suspend or hibernate. For example log:
>
> [77.376851] [020/123] (932s left) kms_flip (2x-flip-vs-suspend)
> [77.592412] Starting subtest: 2x-flip-vs-suspend
> [77.604996] Starting dynamic subtest: AB-DP2-HDMI-A3
> [115.135795] Dynamic subtest AB-DP2-HDMI-A3: SUCCESS (6.776s)
>
> shows test runs for around 6 seconds, while wall time shows
> it took around 38 seconds.
>
> Create a separate, runner specific function for time measure
> and use it where current time is needed.
>
> Cc: Ewelina Musial <ewelina.musial@intel.com>
> Cc: Petri Latvala <adrinael@adrinael.net>
> Reported-by: Karol Krol <karol.krol@intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
> runner/executor.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/runner/executor.c b/runner/executor.c
> index 9c8bf90f0..30e2420af 100644
> --- a/runner/executor.c
> +++ b/runner/executor.c
> @@ -47,6 +47,12 @@ static struct {
> size_t num_dogs;
> } watchdogs;
>
> +static void runner_gettime(struct timespec *tv)
> +{
> + if (clock_gettime(CLOCK_BOOTTIME, tv))
> + clock_gettime(CLOCK_REALTIME, tv);
> +}
Tested-by: Peter Senna Tschudin <peter.senna@linux.intel.com>
Reviewed-by: Peter Senna Tschudin <peter.senna@linux.intel.com>
> +
> __attribute__((format(printf, 2, 3)))
> static void __logf__(FILE *stream, const char *fmt, ...)
> {
> @@ -54,8 +60,7 @@ static void __logf__(FILE *stream, const char *fmt, ...)
> struct timespec tv;
> va_list ap;
>
> - if (clock_gettime(CLOCK_BOOTTIME, &tv))
> - clock_gettime(CLOCK_REALTIME, &tv);
> + runner_gettime(&tv);
> fprintf(stream, "[%ld.%06ld] ", tv.tv_sec, tv.tv_nsec / 1000);
>
> va_start(ap, fmt);
> @@ -961,7 +966,7 @@ static int monitor_output(pid_t child,
> bool socket_comms_used = false; /* whether the test actually uses comms */
> bool results_received = false; /* whether we already have test results that might need overriding if we detect an abort condition */
>
> - igt_gettime(&time_beg);
> + runner_gettime(&time_beg);
> time_last_activity = time_last_subtest = time_killed = time_beg;
>
> if (errfd > nfds)
> @@ -1024,7 +1029,7 @@ static int monitor_output(pid_t child,
> return -1;
> }
>
> - igt_gettime(&time_now);
> + runner_gettime(&time_now);
>
> /* TODO: Refactor these handlers to their own functions */
> if (outfd >= 0 && FD_ISSET(outfd, &set)) {
next prev parent reply other threads:[~2025-04-02 11:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 16:33 [PATCH i-g-t v1 0/1] runner: Use BOOTTIME for time checks Kamil Konieczny
2025-03-28 16:33 ` [PATCH i-g-t v1 1/1] runner/executor: Use bootime " Kamil Konieczny
2025-04-02 10:17 ` Piatkowski, Dominik Karol
2025-04-02 11:15 ` Peter Senna Tschudin [this message]
2025-03-29 2:42 ` ✓ Xe.CI.BAT: success for runner: Use BOOTTIME " Patchwork
2025-03-29 2:56 ` ✓ i915.CI.BAT: " Patchwork
2025-03-29 8:13 ` ✗ i915.CI.Full: failure " Patchwork
2025-03-29 21:16 ` ✗ Xe.CI.Full: " Patchwork
2025-04-06 20:03 ` Patchwork
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=8e72dab2-1bb0-41c4-8a1d-d409689cd61c@linux.intel.com \
--to=peter.senna@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
/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