All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 2/2] igt/perf_pmu: Improve the presentation of the accuracy calibration
Date: Wed,  8 Aug 2018 15:59:45 +0100	[thread overview]
Message-ID: <20180808145945.26159-2-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20180808145945.26159-1-chris@chris-wilson.co.uk>

Normalize the variance to stddev, and remove some redundant steps in
computing the time from itself.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 tests/perf_pmu.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 5a26d5272..4e8da3d94 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -1577,8 +1577,8 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
 		/* 1st pass is calibration, second pass is the test. */
 		for (int pass = 0; pass < ARRAY_SIZE(timeout); pass++) {
 			unsigned int target_idle_us = idle_us;
-			uint64_t busy_ns = 0, idle_ns = 0;
 			struct timespec start = { };
+			uint64_t busy_ns = 0;
 			unsigned long pass_ns = 0;
 			double avg = 0.0, var = 0.0;
 			unsigned int n = 0;
@@ -1589,6 +1589,7 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
 				unsigned long loop_ns, loop_busy;
 				struct timespec _ts = { };
 				double err, tmp;
+				uint64_t now;
 
 				/* PWM idle sleep. */
 				_ts.tv_nsec = target_idle_us * 1000;
@@ -1605,14 +1606,13 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
 				igt_spin_batch_end(spin);
 
 				/* Time accounting. */
-				loop_ns = igt_nsec_elapsed(&start);
-				loop_busy = loop_ns - loop_busy;
-				loop_ns -= pass_ns;
+				now = igt_nsec_elapsed(&start);
+				loop_busy = now - loop_busy;
+				loop_ns = now - pass_ns;
+				pass_ns = now;
 
 				busy_ns += loop_busy;
 				total_busy_ns += loop_busy;
-				idle_ns += loop_ns - loop_busy;
-				pass_ns += loop_ns;
 				total_ns += loop_ns;
 
 				/* Re-calibrate. */
@@ -1628,10 +1628,14 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
 				var += (err - avg) * (err - tmp);
 			} while (pass_ns < timeout[pass]);
 
+			pass_ns = igt_nsec_elapsed(&start);
 			expected = (double)busy_ns / pass_ns;
-			igt_info("%u: busy %"PRIu64"us, idle %"PRIu64"us -> %.2f%% (target: %lu%%; average=%.2f, variance=%f)\n",
-				 pass, busy_ns / 1000, idle_ns / 1000,
-				 100 * expected, target_busy_pct, avg, var / n);
+
+			igt_info("%u: busy %"PRIu64"us, idle %"PRIu64"us -> %.2f%% (target: %lu%%; average=%.2f±%.3f%%)\n",
+				 pass, busy_ns / 1000, (pass_ns - busy_ns) / 1000,
+				 100 * expected, target_busy_pct,
+				 avg, sqrt(var / n));
+
 			write(link[1], &expected, sizeof(expected));
 		}
 
-- 
2.18.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t 2/2] igt/perf_pmu: Improve the presentation of the accuracy calibration
Date: Wed,  8 Aug 2018 15:59:45 +0100	[thread overview]
Message-ID: <20180808145945.26159-2-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20180808145945.26159-1-chris@chris-wilson.co.uk>

Normalize the variance to stddev, and remove some redundant steps in
computing the time from itself.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 tests/perf_pmu.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 5a26d5272..4e8da3d94 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -1577,8 +1577,8 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
 		/* 1st pass is calibration, second pass is the test. */
 		for (int pass = 0; pass < ARRAY_SIZE(timeout); pass++) {
 			unsigned int target_idle_us = idle_us;
-			uint64_t busy_ns = 0, idle_ns = 0;
 			struct timespec start = { };
+			uint64_t busy_ns = 0;
 			unsigned long pass_ns = 0;
 			double avg = 0.0, var = 0.0;
 			unsigned int n = 0;
@@ -1589,6 +1589,7 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
 				unsigned long loop_ns, loop_busy;
 				struct timespec _ts = { };
 				double err, tmp;
+				uint64_t now;
 
 				/* PWM idle sleep. */
 				_ts.tv_nsec = target_idle_us * 1000;
@@ -1605,14 +1606,13 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
 				igt_spin_batch_end(spin);
 
 				/* Time accounting. */
-				loop_ns = igt_nsec_elapsed(&start);
-				loop_busy = loop_ns - loop_busy;
-				loop_ns -= pass_ns;
+				now = igt_nsec_elapsed(&start);
+				loop_busy = now - loop_busy;
+				loop_ns = now - pass_ns;
+				pass_ns = now;
 
 				busy_ns += loop_busy;
 				total_busy_ns += loop_busy;
-				idle_ns += loop_ns - loop_busy;
-				pass_ns += loop_ns;
 				total_ns += loop_ns;
 
 				/* Re-calibrate. */
@@ -1628,10 +1628,14 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
 				var += (err - avg) * (err - tmp);
 			} while (pass_ns < timeout[pass]);
 
+			pass_ns = igt_nsec_elapsed(&start);
 			expected = (double)busy_ns / pass_ns;
-			igt_info("%u: busy %"PRIu64"us, idle %"PRIu64"us -> %.2f%% (target: %lu%%; average=%.2f, variance=%f)\n",
-				 pass, busy_ns / 1000, idle_ns / 1000,
-				 100 * expected, target_busy_pct, avg, var / n);
+
+			igt_info("%u: busy %"PRIu64"us, idle %"PRIu64"us -> %.2f%% (target: %lu%%; average=%.2f±%.3f%%)\n",
+				 pass, busy_ns / 1000, (pass_ns - busy_ns) / 1000,
+				 100 * expected, target_busy_pct,
+				 avg, sqrt(var / n));
+
 			write(link[1], &expected, sizeof(expected));
 		}
 
-- 
2.18.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-08-08 14:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-08 14:59 [PATCH i-g-t 1/2] igt/perf_pmu: Aim for a fixed number of iterations for calibrating accuracy Chris Wilson
2018-08-08 14:59 ` [igt-dev] " Chris Wilson
2018-08-08 14:59 ` Chris Wilson [this message]
2018-08-08 14:59   ` [Intel-gfx] [PATCH i-g-t 2/2] igt/perf_pmu: Improve the presentation of the accuracy calibration Chris Wilson
2018-08-30 16:53   ` Tvrtko Ursulin
2018-08-30 16:53     ` [Intel-gfx] " Tvrtko Ursulin
2018-08-08 15:38 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] igt/perf_pmu: Aim for a fixed number of iterations for calibrating accuracy Patchwork
2018-08-08 21:49 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-08-09 11:54 ` [igt-dev] [PATCH i-g-t 1/2] " Tvrtko Ursulin
2018-08-09 11:54   ` Tvrtko Ursulin
2018-08-10 13:25   ` Chris Wilson
2018-08-10 13:25     ` Chris Wilson
2018-08-13  9:20     ` Tvrtko Ursulin
2018-08-13  9:20       ` Tvrtko Ursulin
2018-08-30 16:31 ` Tvrtko Ursulin
2018-08-30 16:31   ` [igt-dev] [Intel-gfx] " Tvrtko Ursulin

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=20180808145945.26159-2-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@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.