diff mbox

[i-g-t,2/4] skl_compute_wrpll: Print the average deviation

Message ID 1435245703-31083-2-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien June 25, 2015, 3:21 p.m. UTC
It's interesting to watch the effect of some algorithm tweaks on the
average deviation between the central freq and the dco freq. A metric
we'd like to minimize.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 tools/skl_compute_wrpll.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox

Patch

diff --git a/tools/skl_compute_wrpll.c b/tools/skl_compute_wrpll.c
index 55f2df4..be4fc26 100644
--- a/tools/skl_compute_wrpll.c
+++ b/tools/skl_compute_wrpll.c
@@ -29,6 +29,8 @@ 
 #include <stdlib.h>
 #include <string.h>
 
+#include "igt_stats.h"
+
 #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
 
 #define WARN(cond, msg)	printf(msg)
@@ -844,6 +846,9 @@  static void test_run(struct test_ops *test)
 {
 	unsigned int m;
 	unsigned p_odd_even[2] = { 0, 0 };
+	igt_stats_t stats;
+
+	igt_stats_init(&stats, ARRAY_SIZE(modes));
 
 	for (m = 0; m < ARRAY_SIZE(modes); m++) {
 		struct skl_wrpll_params params = {};
@@ -871,6 +876,8 @@  static void test_run(struct test_ops *test)
 			diff = abs_diff(dco_freq, central_freq);
 			deviation = div64_u64(10000 * diff, central_freq);
 
+			igt_stats_push(&stats, deviation);
+
 			if (dco_freq > central_freq) {
 				if (deviation > 100)
 					printf("failed constraint for %dHz "
@@ -892,6 +899,9 @@  static void test_run(struct test_ops *test)
 	}
 
 	printf("even/odd dividers: %d/%d\n", p_odd_even[0], p_odd_even[1]);
+	printf("average deviation: %.2lf\n", igt_stats_get_average(&stats));
+
+	igt_stats_fini(&stats);
 }
 
 int main(int argc, char **argv)