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 v2 1/3] tests/perf_pmu: Use perf timestamps in a few more places
Date: Mon, 12 Feb 2018 09:46:38 +0000 [thread overview]
Message-ID: <20180212094638.4561-1-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <151807736566.28809.1157399112065278030@mail.alporthouse.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Use perf timestamps in more places where possible.
v2: Log measure_usleep vs perf timestamps. (Chris Wilson)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tests/perf_pmu.c | 47 +++++++++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 20 deletions(-)
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index a27a8a81ec89..afc7dc992681 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -204,8 +204,8 @@ static void
busy_start(int gem_fd, const struct intel_execution_engine2 *e)
{
unsigned long slept;
+ uint64_t val, ts[2];
igt_spin_t *spin;
- uint64_t val;
int fd;
/*
@@ -224,14 +224,15 @@ busy_start(int gem_fd, const struct intel_execution_engine2 *e)
fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance));
- val = pmu_read_single(fd);
+ val = __pmu_read_single(fd, &ts[0]);
slept = measured_usleep(batch_duration_ns / 1000);
- val = pmu_read_single(fd) - val;
+ val = __pmu_read_single(fd, &ts[1]) - val;
+ igt_debug("slept=%lu perf=%"PRIu64"\n", slept, ts[1] - ts[0]);
igt_spin_batch_free(gem_fd, spin);
close(fd);
- assert_within_epsilon(val, slept, tolerance);
+ assert_within_epsilon(val, ts[1] - ts[0], tolerance);
gem_quiescent_gpu(gem_fd);
}
@@ -244,8 +245,8 @@ static void
busy_double_start(int gem_fd, const struct intel_execution_engine2 *e)
{
unsigned long slept;
+ uint64_t val, val2, ts[2];
igt_spin_t *spin[2];
- uint64_t val, val2;
uint32_t ctx;
int fd;
@@ -272,9 +273,10 @@ busy_double_start(int gem_fd, const struct intel_execution_engine2 *e)
*/
fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance));
- val = pmu_read_single(fd);
+ val = __pmu_read_single(fd, &ts[0]);
slept = measured_usleep(batch_duration_ns / 1000);
- val = pmu_read_single(fd) - val;
+ val = __pmu_read_single(fd, &ts[1]) - val;
+ igt_debug("slept=%lu perf=%"PRIu64"\n", slept, ts[1] - ts[0]);
igt_spin_batch_end(spin[0]);
igt_spin_batch_end(spin[1]);
@@ -295,7 +297,7 @@ busy_double_start(int gem_fd, const struct intel_execution_engine2 *e)
gem_context_destroy(gem_fd, ctx);
- assert_within_epsilon(val, slept, tolerance);
+ assert_within_epsilon(val, ts[1] - ts[0], tolerance);
igt_assert_eq(val2, 0);
gem_quiescent_gpu(gem_fd);
@@ -821,9 +823,9 @@ 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[2];
+ unsigned long slept[2];
+ uint64_t val[2], ts[2], perf_slept[2];
igt_spin_t *spin;
- uint64_t val[2];
int fd[2];
gem_quiescent_gpu(gem_fd);
@@ -839,21 +841,25 @@ multi_client(int gem_fd, const struct intel_execution_engine2 *e)
spin = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
- val[0] = val[1] = pmu_read_single(fd[0]);
+ val[0] = val[1] = __pmu_read_single(fd[0], &ts[0]);
slept[1] = measured_usleep(batch_duration_ns / 1000);
- val[1] = pmu_read_single(fd[1]) - val[1];
+ val[1] = __pmu_read_single(fd[1], &ts[1]) - val[1];
+ perf_slept[1] = ts[1] - ts[0];
+ igt_debug("slept=%lu perf=%"PRIu64"\n", slept[1], perf_slept[1]);
close(fd[1]);
slept[0] = measured_usleep(batch_duration_ns / 1000) + slept[1];
- val[0] = pmu_read_single(fd[0]) - val[0];
+ val[0] = __pmu_read_single(fd[0], &ts[1]) - val[0];
+ perf_slept[0] = ts[1] - ts[0];
+ igt_debug("slept=%lu perf=%"PRIu64"\n", slept[0], perf_slept[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], slept[0], tolerance);
- assert_within_epsilon(val[1], slept[1], tolerance);
+ assert_within_epsilon(val[0], perf_slept[0], tolerance);
+ assert_within_epsilon(val[1], perf_slept[1], tolerance);
}
/**
@@ -1252,8 +1258,8 @@ static void
test_rc6(int gem_fd, unsigned int flags)
{
int64_t duration_ns = 2e9;
- uint64_t idle, busy, prev;
- unsigned int slept;
+ uint64_t idle, busy, prev, ts[2];
+ unsigned long slept;
int fd, fw;
gem_quiescent_gpu(gem_fd);
@@ -1288,11 +1294,12 @@ test_rc6(int gem_fd, unsigned int flags)
igt_require(wait_for_rc6(fd));
/* While idle check full RC6. */
- prev = pmu_read_single(fd);
+ prev = __pmu_read_single(fd, &ts[0]);
slept = measured_usleep(duration_ns / 1000);
- idle = pmu_read_single(fd);
+ idle = __pmu_read_single(fd, &ts[1]);
+ igt_debug("slept=%lu perf=%"PRIu64"\n", slept, ts[1] - ts[0]);
- assert_within_epsilon(idle - prev, slept, tolerance);
+ assert_within_epsilon(idle - prev, ts[1] - ts[0], tolerance);
/* Wake up device and check no RC6. */
fw = igt_open_forcewake_handle(gem_fd);
--
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-12 9:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 8:01 [igt-dev] [PATCH i-g-t 1/3] tests/perf_pmu: Use perf timestamps in a few more places Tvrtko Ursulin
2018-02-08 8:01 ` [igt-dev] [PATCH i-g-t 2/3] tests/perf_pmu: Handle thermally throttled devices Tvrtko Ursulin
2018-02-08 8:10 ` Chris Wilson
2018-02-12 9:47 ` [igt-dev] [PATCH i-g-t v2 " Tvrtko Ursulin
2018-02-12 10:00 ` Chris Wilson
2018-02-12 11:35 ` [igt-dev] [PATCH i-g-t v3 " Tvrtko Ursulin
2018-02-08 8:01 ` [igt-dev] [PATCH i-g-t 3/3] tests/perf_pmu: Give sampling more time Tvrtko Ursulin
2018-02-08 8:13 ` Chris Wilson
2018-02-12 9:55 ` Tvrtko Ursulin
2018-02-12 10:02 ` Chris Wilson
2018-02-12 11:36 ` [igt-dev] [PATCH i-g-t v2 " Tvrtko Ursulin
2018-02-12 11:39 ` Chris Wilson
2018-02-08 8:09 ` [igt-dev] [PATCH i-g-t 1/3] tests/perf_pmu: Use perf timestamps in a few more places Chris Wilson
2018-02-12 9:46 ` Tvrtko Ursulin [this message]
2018-02-12 9:57 ` [igt-dev] [PATCH i-g-t v2 " Chris Wilson
2018-02-08 10:27 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
2018-02-08 15:13 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-02-12 10:28 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/3] tests/perf_pmu: Use perf timestamps in a few more places (rev3) Patchwork
2018-02-12 12:02 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork
2018-02-12 16:44 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/3] tests/perf_pmu: Use perf timestamps in a few more places (rev5) Patchwork
2018-02-12 17:02 ` Patchwork
2018-02-12 19:00 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-02-12 19:40 ` 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=20180212094638.4561-1-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.