From patchwork Thu Jun 25 23:26:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 6677851 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6E24DC05AC for ; Thu, 25 Jun 2015 23:27:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6145F206F9 for ; Thu, 25 Jun 2015 23:27:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 389E6206F7 for ; Thu, 25 Jun 2015 23:27:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E9276E4A9; Thu, 25 Jun 2015 16:27:03 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id B8FDD6E47D for ; Thu, 25 Jun 2015 16:27:02 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 25 Jun 2015 16:27:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,680,1427785200"; d="scan'208";a="594940183" Received: from mpaszkie-mobl1.ger.corp.intel.com (HELO strange.ger.corp.intel.com) ([10.252.33.58]) by orsmga003.jf.intel.com with ESMTP; 25 Jun 2015 16:27:01 -0700 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Fri, 26 Jun 2015 00:26:55 +0100 Message-Id: <1435274819-2777-1-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 2.1.0 Subject: [Intel-gfx] [PATCH i-g-t 1/5] stats: Be more precise and talk about mean, not average X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There are several types of averages eg. mean, median and mode. Signed-off-by: Damien Lespiau --- lib/igt_stats.c | 2 +- lib/igt_stats.h | 2 +- lib/tests/igt_stats.c | 10 +++++----- tools/skl_compute_wrpll.c | 3 ++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/igt_stats.c b/lib/igt_stats.c index fcf7abe..e6babde 100644 --- a/lib/igt_stats.c +++ b/lib/igt_stats.c @@ -44,7 +44,7 @@ void igt_stats_push(igt_stats_t *stats, uint64_t value) stats->values[stats->n_values++] = value; } -double igt_stats_get_average(igt_stats_t *stats) +double igt_stats_get_mean(igt_stats_t *stats) { unsigned int i; double a = 0.0; diff --git a/lib/igt_stats.h b/lib/igt_stats.h index 99dc1c9..a46b399 100644 --- a/lib/igt_stats.h +++ b/lib/igt_stats.h @@ -33,4 +33,4 @@ typedef struct { void igt_stats_init(igt_stats_t *stats, unsigned int capacity); void igt_stats_fini(igt_stats_t *stats); void igt_stats_push(igt_stats_t *stats, uint64_t value); -double igt_stats_get_average(igt_stats_t *stats); +double igt_stats_get_mean(igt_stats_t *stats); diff --git a/lib/tests/igt_stats.c b/lib/tests/igt_stats.c index e75a203..3f45314 100644 --- a/lib/tests/igt_stats.c +++ b/lib/tests/igt_stats.c @@ -25,10 +25,10 @@ #include "igt_core.h" #include "igt_stats.h" -static void test_average(void) +static void test_mean(void) { igt_stats_t stats; - double average; + double mean; igt_stats_init(&stats, 5); @@ -38,12 +38,12 @@ static void test_average(void) igt_stats_push(&stats, 8); igt_stats_push(&stats, 10); - average = igt_stats_get_average(&stats); + mean = igt_stats_get_mean(&stats); - igt_assert(average == (2 + 4 + 6 + 8 + 10) / 5.); + igt_assert(mean == (2 + 4 + 6 + 8 + 10) / 5.); } igt_simple_main { - test_average(); + test_mean(); } diff --git a/tools/skl_compute_wrpll.c b/tools/skl_compute_wrpll.c index 9245724..cf808c7 100644 --- a/tools/skl_compute_wrpll.c +++ b/tools/skl_compute_wrpll.c @@ -917,7 +917,8 @@ 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)); + printf("mean central freq deviation: %.2lf\n", + igt_stats_get_mean(&stats)); igt_stats_fini(&stats); }