Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t 1/3] tests/intel/xe_query: Stop getting refclock multiple times
Date: Thu, 10 Oct 2024 22:05:05 -0500	[thread overview]
Message-ID: <20241011030507.321961-1-lucas.demarchi@intel.com> (raw)

In theory it could be different per hwe (but in practice isn't). In any
case, it shouldn't change on multiple invocations of the query. So stop
doing it twice per loop.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 tests/intel/xe_query.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/intel/xe_query.c b/tests/intel/xe_query.c
index 4c79a02b0..9e0fa93dd 100644
--- a/tests/intel/xe_query.c
+++ b/tests/intel/xe_query.c
@@ -713,7 +713,7 @@ __engine_cycles(int fd, struct drm_xe_engine_class_instance *hwe)
 	int i, usable = 0;
 	igt_spin_t *spin;
 	uint64_t ahnd;
-	uint32_t vm, eng_ref_clock1, eng_ref_clock2;
+	uint32_t vm, eng_ref_clock;
 	struct {
 		int32_t id;
 		const char *name;
@@ -746,31 +746,31 @@ __engine_cycles(int fd, struct drm_xe_engine_class_instance *hwe)
 		ts2.clockid = clock[index].id;
 
 		query_engine_cycles(fd, &ts1);
-		eng_ref_clock1 = __engine_reference_clock(fd, hwe->gt_id);
 		query_engine_cycles(fd, &ts2);
-		eng_ref_clock2 = __engine_reference_clock(fd, hwe->gt_id);
+		eng_ref_clock = __engine_reference_clock(fd, hwe->gt_id);
 
 		igt_debug("[1] cpu_ts before %llu, reg read time %llu\n",
 			  ts1.cpu_timestamp,
 			  ts1.cpu_delta);
-		igt_debug("[1] engine_ts %llu, freq %u Hz, width %u\n",
-			  ts1.engine_cycles, eng_ref_clock1, ts1.width);
+		igt_debug("[1] engine_ts %llu, width %u\n",
+			  ts1.engine_cycles, ts1.width);
 
 		igt_debug("[2] cpu_ts before %llu, reg read time %llu\n",
 			  ts2.cpu_timestamp,
 			  ts2.cpu_delta);
-		igt_debug("[2] engine_ts %llu, freq %u Hz, width %u\n",
-			  ts2.engine_cycles, eng_ref_clock2, ts2.width);
+		igt_debug("[2] engine_ts %llu, width %u\n",
+			  ts2.engine_cycles, ts2.width);
 
 		delta_cpu = ts2.cpu_timestamp - ts1.cpu_timestamp;
 
 		if (ts2.engine_cycles >= ts1.engine_cycles)
 			delta_cs = (ts2.engine_cycles - ts1.engine_cycles) *
-				   NSEC_PER_SEC / eng_ref_clock1;
+				   NSEC_PER_SEC / eng_ref_clock;
 		else
 			delta_cs = (((1 << ts2.width) - ts2.engine_cycles) + ts1.engine_cycles) *
-				   NSEC_PER_SEC / eng_ref_clock1;
+				   NSEC_PER_SEC / eng_ref_clock;
 
+		igt_debug("freq %u Hz\n", eng_ref_clock);
 		igt_debug("delta_cpu[%"PRIu64"], delta_cs[%"PRIu64"]\n",
 			  delta_cpu, delta_cs);
 
-- 
2.46.2


             reply	other threads:[~2024-10-11  3:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  3:05 Lucas De Marchi [this message]
2024-10-11  3:05 ` [PATCH i-g-t 2/3] tests/intel/xe_query: Add debug messsage with calculated refclock Lucas De Marchi
2024-10-11 16:55   ` Kamil Konieczny
2024-10-11  3:05 ` [PATCH i-g-t 3/3] tests/intel/xe_query: Clarify delta engine_cycles calculation Lucas De Marchi
2024-10-11 17:11   ` Kamil Konieczny
2024-10-11 14:34 ` ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] tests/intel/xe_query: Stop getting refclock multiple times Patchwork
2024-10-11 15:09 ` ✗ CI.xeBAT: failure " Patchwork
2024-10-11 16:36 ` [PATCH i-g-t 1/3] " Kamil Konieczny
2024-10-11 18:00 ` ✗ CI.xeFULL: failure for series starting with [i-g-t,1/3] " Patchwork
2024-10-12  7:32 ` ✗ Fi.CI.IGT: " 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=20241011030507.321961-1-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=igt-dev@lists.freedesktop.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