From: Tvrtko Ursulin <tursulin@ursulin.net>
To: igt-dev@lists.freedesktop.org
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [igt-dev] [PATCH i-g-t 3/3] tests/perf_pmu: Use measured sleep in all time based tests
Date: Thu, 1 Feb 2018 12:47:46 +0000 [thread overview]
Message-ID: <20180201124746.10641-4-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20180201124746.10641-1-tvrtko.ursulin@linux.intel.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Stop relying on timers to end spin batches but use measured sleep, which
was established to work better, in all time based tests.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tests/perf_pmu.c | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index bdf452c8347c..e27e74abe686 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -454,30 +454,31 @@ static void
no_sema(int gem_fd, const struct intel_execution_engine2 *e, bool busy)
{
igt_spin_t *spin;
- uint64_t val[2];
+ uint64_t val[2][2];
int fd;
fd = open_group(I915_PMU_ENGINE_SEMA(e->class, e->instance), -1);
open_group(I915_PMU_ENGINE_WAIT(e->class, e->instance), fd);
- if (busy) {
+ if (busy)
spin = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
- igt_spin_batch_set_timeout(spin, batch_duration_ns);
- } else {
- usleep(batch_duration_ns / 1000);
- }
- if (busy)
- gem_sync(gem_fd, spin->handle);
+ pmu_read_multi(fd, 2, val[0]);
+ measured_usleep(batch_duration_ns / 1000);
+ pmu_read_multi(fd, 2, val[1]);
- pmu_read_multi(fd, 2, val);
+ val[0][0] = val[1][0] - val[0][0];
+ val[0][1] = val[1][1] - val[0][1];
- if (busy)
+ if (busy) {
+ igt_spin_batch_end(spin);
+ gem_sync(gem_fd, spin->handle);
igt_spin_batch_free(gem_fd, spin);
+ }
close(fd);
- assert_within_epsilon(val[0], 0.0f, tolerance);
- assert_within_epsilon(val[1], 0.0f, tolerance);
+ assert_within_epsilon(val[0][0], 0.0f, tolerance);
+ assert_within_epsilon(val[0][1], 0.0f, tolerance);
}
#define MI_INSTR(opcode, flags) (((opcode) << 23) | (flags))
@@ -766,7 +767,7 @@ static void
multi_client(int gem_fd, const struct intel_execution_engine2 *e)
{
uint64_t config = I915_PMU_ENGINE_BUSY(e->class, e->instance);
- unsigned int slept;
+ unsigned int slept[2];
igt_spin_t *spin;
uint64_t val[2];
int fd[2];
@@ -781,23 +782,22 @@ multi_client(int gem_fd, const struct intel_execution_engine2 *e)
fd[1] = open_pmu(config);
spin = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
- igt_spin_batch_set_timeout(spin, 2 * batch_duration_ns);
- val[0] = pmu_read_single(fd[0]);
- val[1] = pmu_read_single(fd[1]);
- slept = measured_usleep(batch_duration_ns / 1000);
+ val[0] = val[1] = pmu_read_single(fd[0]);
+ slept[1] = measured_usleep(batch_duration_ns / 1000);
val[1] = pmu_read_single(fd[1]) - val[1];
close(fd[1]);
- gem_sync(gem_fd, spin->handle);
-
+ slept[0] = measured_usleep(batch_duration_ns / 1000) + slept[1];
val[0] = pmu_read_single(fd[0]) - val[0];
+ igt_spin_batch_end(spin);
+ gem_sync(gem_fd, spin->handle);
igt_spin_batch_free(gem_fd, spin);
close(fd[0]);
- assert_within_epsilon(val[0], 2 * batch_duration_ns, tolerance);
- assert_within_epsilon(val[1], slept, tolerance);
+ assert_within_epsilon(val[0], slept[0], tolerance);
+ assert_within_epsilon(val[1], slept[1], tolerance);
}
/**
--
2.14.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2018-02-01 12:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-01 12:47 [igt-dev] [PATCH i-g-t 0/3] perf_pmu reliability improvements Tvrtko Ursulin
2018-02-01 12:47 ` [igt-dev] [PATCH i-g-t 1/3] tests/perf_pmu: Tighten busy measurement Tvrtko Ursulin
2018-02-01 12:57 ` Chris Wilson
2018-02-01 16:26 ` Tvrtko Ursulin
2018-02-01 16:39 ` Chris Wilson
2018-02-01 16:58 ` Tvrtko Ursulin
2018-02-01 17:08 ` Chris Wilson
2018-02-01 17:16 ` Chris Wilson
2018-02-01 17:34 ` Chris Wilson
2018-02-01 17:20 ` Tvrtko Ursulin
2018-02-01 12:47 ` [igt-dev] [PATCH i-g-t 2/3] tests/perf_pmu: More busy measurement tightening Tvrtko Ursulin
2018-02-01 12:59 ` Chris Wilson
2018-02-01 16:37 ` Tvrtko Ursulin
2018-02-01 16:48 ` Chris Wilson
2018-02-01 17:02 ` Tvrtko Ursulin
2018-02-01 12:47 ` Tvrtko Ursulin [this message]
2018-02-01 17:37 ` [igt-dev] [PATCH i-g-t 3/3] tests/perf_pmu: Use measured sleep in all time based tests Chris Wilson
2018-02-01 13:22 ` [igt-dev] ✓ Fi.CI.BAT: success for perf_pmu reliability improvements Patchwork
2018-02-01 16:38 ` [igt-dev] ✗ Fi.CI.IGT: warning " 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=20180201124746.10641-4-tvrtko.ursulin@linux.intel.com \
--to=tursulin@ursulin.net \
--cc=igt-dev@lists.freedesktop.org \
--cc=tvrtko.ursulin@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.