From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: adam.miszczak@linux.intel.com, jakub1.kolakowski@intel.com,
lukasz.laguna@intel.com,
Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Subject: [PATCH i-g-t 1/8] tests/intel/xe_sriov_scheduling: Use timestamp helper
Date: Wed, 27 May 2026 22:56:34 +0200 [thread overview]
Message-ID: <20260527205644.2801165-2-marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <20260527205644.2801165-1-marcin.bernatowicz@linux.intel.com>
Replace open-coded timestamp collection with current_timestamp_ns().
Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
---
tests/intel/xe_sriov_scheduling.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/tests/intel/xe_sriov_scheduling.c b/tests/intel/xe_sriov_scheduling.c
index 4228eea2d..509d6fd00 100644
--- a/tests/intel/xe_sriov_scheduling.c
+++ b/tests/intel/xe_sriov_scheduling.c
@@ -85,6 +85,15 @@ struct subm_set {
pthread_barrier_t barrier;
};
+static uint64_t current_timestamp_ns(void)
+{
+ struct timespec tv;
+
+ igt_gettime(&tv);
+
+ return tv.tv_sec * (uint64_t)NSEC_PER_SEC + (uint64_t)tv.tv_nsec;
+}
+
static void subm_init(struct subm *s, int fd, int vf_num, uint64_t addr,
struct drm_xe_engine_class_instance hwe,
unsigned int inflight)
@@ -164,8 +173,6 @@ static void subm_wait_slot(struct subm *s, unsigned int slot, uint64_t abs_timeo
static void subm_exec_slot(struct subm *s, unsigned int slot)
{
- struct timespec tv;
-
syncobj_reset(s->fd, &s->done_fence[slot], 1);
memset(&s->sync[0], 0, sizeof(s->sync));
s->sync[0].type = DRM_XE_SYNC_TYPE_SYNCOBJ;
@@ -174,8 +181,7 @@ static void subm_exec_slot(struct subm *s, unsigned int slot)
s->exec.num_syncs = 1;
s->exec.syncs = to_user_pointer(&s->sync[0]);
s->exec.address = s->addr[slot];
- igt_gettime(&tv);
- s->submit_ts[slot] = (uint64_t)tv.tv_sec * (uint64_t)NSEC_PER_SEC + (uint64_t)tv.tv_nsec;
+ s->submit_ts[slot] = current_timestamp_ns();
xe_exec(s->fd, &s->exec);
}
@@ -200,12 +206,9 @@ static void subm_exec_loop(struct subm *s, struct subm_stats *stats,
{
const unsigned int inflight = s->slots;
unsigned int submitted = 0;
- struct timespec tv;
unsigned int i;
- igt_gettime(&tv);
- stats->start_timestamp =
- tv.tv_sec * (uint64_t)NSEC_PER_SEC + tv.tv_nsec;
+ stats->start_timestamp = current_timestamp_ns();
igt_debug("[%s] start_timestamp: %f\n", s->id, stats->start_timestamp * 1e-9);
/* Prefill */
@@ -222,9 +225,7 @@ static void subm_exec_loop(struct subm *s, struct subm_stats *stats,
unsigned int slot = i % inflight;
subm_wait_slot(s, slot, INT64_MAX);
- igt_gettime(&tv);
- stats->complete_ts[i] = (uint64_t)tv.tv_sec * (uint64_t)NSEC_PER_SEC +
- (uint64_t)tv.tv_nsec;
+ stats->complete_ts[i] = current_timestamp_ns();
igt_stats_push(&stats->samples, stats->complete_ts[i] - s->submit_ts[slot]);
if (!subm_is_work_complete(s, slot)) {
@@ -246,8 +247,7 @@ static void subm_exec_loop(struct subm *s, struct subm_stats *stats,
}
}
- igt_gettime(&tv);
- stats->end_timestamp = tv.tv_sec * (uint64_t)NSEC_PER_SEC + tv.tv_nsec;
+ stats->end_timestamp = current_timestamp_ns();
igt_debug("[%s] end_timestamp: %f\n", s->id, stats->end_timestamp * 1e-9);
}
--
2.43.0
next prev parent reply other threads:[~2026-05-27 20:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 20:56 [PATCH i-g-t 0/8] tests/intel/xe_sriov_scheduling: improve scheduling coverage Marcin Bernatowicz
2026-05-27 20:56 ` Marcin Bernatowicz [this message]
2026-05-28 10:43 ` [PATCH i-g-t 1/8] tests/intel/xe_sriov_scheduling: Use timestamp helper Kamil Konieczny
2026-05-27 20:56 ` [PATCH i-g-t 2/8] tests/intel/xe_sriov_scheduling: Add scheduling priority support Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 3/8] tests/intel/xe_sriov_scheduling: Make sysfs_get_job_timeout_ms take const eci Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 4/8] tests/intel/xe_sriov_scheduling: Add PMU-based verification helpers Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 5/8] tests/intel/xe_sriov_scheduling: Raise min exec quantum to 2ms Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 6/8] tests/intel/xe_sriov_scheduling: Refactor throughput_ratio and nonpreempt-engine-resets test Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 7/8] tests/intel/xe_sriov_scheduling: Remove unused log_sample_values helper Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 8/8] tests/intel/xe_sriov_scheduling: Add default fair scheduling test Marcin Bernatowicz
2026-05-28 0:01 ` ✓ Xe.CI.BAT: success for tests/intel/xe_sriov_scheduling: improve scheduling coverage Patchwork
2026-05-28 0:04 ` ✗ i915.CI.BAT: failure " Patchwork
2026-05-28 12:15 ` ✓ Xe.CI.FULL: success " 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=20260527205644.2801165-2-marcin.bernatowicz@linux.intel.com \
--to=marcin.bernatowicz@linux.intel.com \
--cc=adam.miszczak@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jakub1.kolakowski@intel.com \
--cc=lukasz.laguna@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