All of lore.kernel.org
 help / color / mirror / Atom feed
From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH i-g-t 5/5] i915/pmu: Add a new test to use total_active_ticks for busyness
Date: Fri, 22 Sep 2023 15:18:12 -0700	[thread overview]
Message-ID: <ZQ4SpMfup75rZR++@unerlige-ril> (raw)
In-Reply-To: <20230922215233.2438200-6-umesh.nerlige.ramappa@intel.com>

On Fri, Sep 22, 2023 at 02:52:33PM -0700, Umesh Nerlige Ramappa wrote:
>Busyness percentage can be calculated using the total-active-ticks
>counter as follows:
>
>% busyness = ((delta of xxxx-busy-ticks) * 100) / delta total-active-ticks
>
>Add a test to check busyness using this method.
>
>Note that total-active-ticks is updated only every 100 ms, so
>granularity of the busy-idle test is affected. To account for this, the
>test duration is set to a larger value for the new busyness interface.
>
>Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>---
> tests/intel/perf_pmu.c | 77 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 77 insertions(+)
>
>diff --git a/tests/intel/perf_pmu.c b/tests/intel/perf_pmu.c
>index 5999d1e22..80182dbfa 100644
>--- a/tests/intel/perf_pmu.c
>+++ b/tests/intel/perf_pmu.c
>@@ -249,6 +249,16 @@
>  * Description: Test the i915 pmu perf interface
>  * Feature: i915 pmu perf interface, pmu
>  * Test category: Perf
>+ *
>+ * SUBTEST: busy-ticks
>+ * Description: Test the i915 v2 engine active busyness interface
>+ * Feature: i915 pmu perf interface, pmu
>+ * Test category: Perf
>+ *
>+ * SUBTEST: busy-idle-ticks
>+ * Description: Test the i915 v2 engine idle busyness interface
>+ * Feature: i915 pmu perf interface, pmu
>+ * Test category: Perf
>  */
>
> IGT_TEST_DESCRIPTION("Test the i915 pmu perf interface");
>@@ -2547,6 +2557,63 @@ static void pmu_read(int i915)
> 	close(pmu_fd);
> }
>
>+static void
>+single_ticks(int gem_fd, const intel_ctx_t *ctx,
>+	     const struct intel_execution_engine2 *e, unsigned int flags)
>+{
>+	igt_spin_t *spin;
>+	uint64_t before[2], after[2];
>+	uint64_t busy_ticks, total_active_ticks;
>+	int fd[2];
>+	uint64_t ahnd = get_reloc_ahnd(gem_fd, ctx->id);
>+	struct i915_engine_class_instance ci = {
>+		e->class,
>+		e->instance,
>+	};
>+	int gt = gem_engine_to_gt_map(gem_fd, &ci);
>+	double busy_percent;
>+	const unsigned long batch_long_duration_ns = 2000e6;
>+
>+	fd[0] = open_group(gem_fd, __I915_PMU_ENGINE_BUSY(e->class, e->instance), -1);
>+	fd[1] = open_group(gem_fd, __I915_PMU_TOTAL_ACTIVE_TICKS(gt), fd[0]);
>+
>+	if (flags & TEST_BUSY) {
>+		spin = igt_sync_spin(gem_fd, ahnd, ctx, e);
>+	} else {
>+		spin = NULL;
>+		gem_quiescent_gpu(gem_fd);
>+	}
>+
>+	pmu_read_multi(fd[0], 2, before);
>+	measured_usleep(batch_long_duration_ns / 1000);
>+	if (flags & TEST_TRAILING_IDLE)
>+		end_spin(gem_fd, spin, flags);
>+	pmu_read_multi(fd[0], 2, after);
>+
>+	end_spin(gem_fd, spin, FLAG_SYNC);
>+
>+	busy_ticks = after[0] - before[0];
>+	total_active_ticks = after[1] - before[1];
>+
>+	igt_info("BUSY: after %ld, before %ld\n", after[0], before[0]);
>+	igt_info("TOTAL: after %ld, before %ld\n", after[1], before[1]);
>+	igt_info("BUSY: delta %ld\n", busy_ticks);
>+	igt_info("TOTAL: delta %ld\n", total_active_ticks);
>+
>+	busy_percent = (double)(busy_ticks * 100) / (double)total_active_ticks;
>+
>+	igt_info("LOCAL: percent %f\n", busy_percent);

Will drop the igt_info in the final revision since it is for debug

Umesh

  reply	other threads:[~2023-09-22 22:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 21:52 [igt-dev] [PATCH i-g-t 0/5] Update IGT tests to support new engine busyness interface Umesh Nerlige Ramappa
2023-09-22 21:52 ` [igt-dev] [PATCH i-g-t 1/5] i915/pmu: Add helpers to convert ticks to ns Umesh Nerlige Ramappa
2023-09-22 21:52 ` [igt-dev] [PATCH i-g-t 2/5] i915/pmu: Pass config directly to the init test Umesh Nerlige Ramappa
2023-09-22 21:52 ` [igt-dev] [PATCH i-g-t 3/5] i915/pmu: Switch to new busyness counter if old one is unavailable Umesh Nerlige Ramappa
2023-09-22 21:52 ` [igt-dev] [PATCH i-g-t 4/5] lib/i915: Export engine to gt mapping Umesh Nerlige Ramappa
2023-09-22 21:52 ` [igt-dev] [PATCH i-g-t 5/5] i915/pmu: Add a new test to use total_active_ticks for busyness Umesh Nerlige Ramappa
2023-09-22 22:18   ` Umesh Nerlige Ramappa [this message]
2023-09-22 22:58 ` [igt-dev] ✗ Fi.CI.BAT: failure for Update IGT tests to support new engine busyness interface Patchwork
2023-09-23  0:04 ` [igt-dev] ✓ CI.xeBAT: 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=ZQ4SpMfup75rZR++@unerlige-ril \
    --to=umesh.nerlige.ramappa@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 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.