From: "Hajda, Andrzej" <andrzej.hajda@intel.com>
To: Maciej Patelczyk <maciej.patelczyk@intel.com>,
<igt-dev@lists.freedesktop.org>
Cc: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Subject: Re: [PATCH i-g-t] tests/xe_eudebug_online: correct calculate the time diff
Date: Mon, 13 Jan 2025 09:26:14 +0100 [thread overview]
Message-ID: <318cf3d2-950b-4be4-b07b-cb5a2c5d6284@intel.com> (raw)
In-Reply-To: <20250110153455.2791158-1-maciej.patelczyk@intel.com>
W dniu 10.01.2025 o 16:34, Maciej Patelczyk pisze:
> When calculating time difference between two timespec values use
> library function which does it right.
>
> Previous way wasn't working well on slower machines. It was only
> taking the tv_nsec field from struct timespec.
>
> Fixes: bbf1730baf ("tests/xe_eudebug_online: Debug client which
> runs workloads on EU")
> CC: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
> Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
> ---
> tests/intel/xe_eudebug_online.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/tests/intel/xe_eudebug_online.c b/tests/intel/xe_eudebug_online.c
> index 052774a3b..f532387af 100644
> --- a/tests/intel/xe_eudebug_online.c
> +++ b/tests/intel/xe_eudebug_online.c
> @@ -2235,6 +2235,11 @@ static int find_suitable_engines(struct drm_xe_engine_class_instance **hwes,
> return engine_count;
> }
>
> +static uint64_t timespecs_diff_us(struct timespec *ts1, struct timespec *ts2)
> +{
> + return (uint64_t)(fabs(igt_time_elapsed(ts1, ts2)) * USEC_PER_SEC);
It seems igt_time_elapsed handles correctly case ts1 > ts2, so the
conversion looks correct.
Something to bikeshed is the conversion from int type to double, then
int again, up to you.
I think there is no need to explicit conversion to uint64_t, no big deal.
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Regards
Andrzej
> +}
> +
> /**
> * SUBTEST: breakpoint-many-sessions-single-tile
> * Description:
> @@ -2255,7 +2260,7 @@ static void test_many_sessions_on_tiles(int fd, bool multi_tile)
> struct online_debug_data **data;
> struct drm_xe_engine_class_instance **hwe;
> struct drm_xe_eudebug_event_eu_attention *eus;
> - uint64_t current_t, next_t, diff;
> + uint64_t diff;
> int attempt_mask = 0, final_mask, should_break;
> int i;
>
> @@ -2318,10 +2323,8 @@ static void test_many_sessions_on_tiles(int fd, bool multi_tile)
> igt_assert_eq(attempt_mask, final_mask);
>
> for (i = 0; i < n - 1; i++) {
> - /* Convert timestamps to microseconds */
> - current_t = data[i]->exception_arrived.tv_nsec * 1000;
> - next_t = data[i + 1]->exception_arrived.tv_nsec * 1000;
> - diff = current_t < next_t ? next_t - current_t : current_t - next_t;
> + diff = timespecs_diff_us(&data[i]->exception_arrived,
> + &data[i + 1]->exception_arrived);
>
> if (multi_tile)
> igt_assert_f(diff < WORKLOAD_DELAY_US,
next prev parent reply other threads:[~2025-01-13 8:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 15:34 [PATCH i-g-t] tests/xe_eudebug_online: correct calculate the time diff Maciej Patelczyk
2025-01-10 18:20 ` ✓ i915.CI.BAT: success for " Patchwork
2025-01-10 18:23 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-13 8:26 ` Hajda, Andrzej [this message]
2025-01-13 8:47 ` [PATCH i-g-t] " Maciej Patelczyk
2025-01-14 20:48 ` ✗ i915.CI.Full: failure for " 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=318cf3d2-950b-4be4-b07b-cb5a2c5d6284@intel.com \
--to=andrzej.hajda@intel.com \
--cc=dominik.grzegorzek@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=maciej.patelczyk@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.