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 2/3] tests/intel/xe_query: Add debug messsage with calculated refclock
Date: Thu, 10 Oct 2024 22:05:06 -0500	[thread overview]
Message-ID: <20241011030507.321961-2-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20241011030507.321961-1-lucas.demarchi@intel.com>

When debugging new hardware, it's useful to check the refclock matches
the expectation. Calculated the expected reflock and print it for quick
check. Eventually this could be a test on its own if the err is stable.

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

diff --git a/tests/intel/xe_query.c b/tests/intel/xe_query.c
index 9e0fa93dd..87ddb58bb 100644
--- a/tests/intel/xe_query.c
+++ b/tests/intel/xe_query.c
@@ -708,7 +708,7 @@ __engine_cycles(int fd, struct drm_xe_engine_class_instance *hwe)
 {
 	struct drm_xe_query_engine_cycles ts1 = {};
 	struct drm_xe_query_engine_cycles ts2 = {};
-	uint64_t delta_cpu, delta_cs, delta_delta;
+	uint64_t delta_cpu, delta_cs, delta_delta, calc_freq;
 	unsigned int exec_queue;
 	int i, usable = 0;
 	igt_spin_t *spin;
@@ -770,7 +770,10 @@ __engine_cycles(int fd, struct drm_xe_engine_class_instance *hwe)
 			delta_cs = (((1 << ts2.width) - ts2.engine_cycles) + ts1.engine_cycles) *
 				   NSEC_PER_SEC / eng_ref_clock;
 
-		igt_debug("freq %u Hz\n", eng_ref_clock);
+		calc_freq = (ts2.engine_cycles - ts1.engine_cycles) * NSEC_PER_SEC / delta_cpu;
+
+		igt_debug("freq %u Hz, calc_freq %"PRIu64" Hz, err %.3f%%\n", eng_ref_clock,
+			  calc_freq, fabs((double)calc_freq - eng_ref_clock) * 100 / 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 [PATCH i-g-t 1/3] tests/intel/xe_query: Stop getting refclock multiple times Lucas De Marchi
2024-10-11  3:05 ` Lucas De Marchi [this message]
2024-10-11 16:55   ` [PATCH i-g-t 2/3] tests/intel/xe_query: Add debug messsage with calculated refclock 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-2-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