From patchwork Tue Apr 25 22:32:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 9699933 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6CECC601D3 for ; Tue, 25 Apr 2017 22:34:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64FD0284EE for ; Tue, 25 Apr 2017 22:34:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57CC12857F; Tue, 25 Apr 2017 22:34:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E2AC3284EE for ; Tue, 25 Apr 2017 22:34:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C72346E0EB; Tue, 25 Apr 2017 22:33:37 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 01AB96E0F4 for ; Tue, 25 Apr 2017 22:33:07 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP; 25 Apr 2017 15:33:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,251,1488873600"; d="scan'208";a="93786945" Received: from ezarza-mobl5.amr.corp.intel.com (HELO delly.amr.corp.intel.com) ([10.254.68.206]) by fmsmga005.fm.intel.com with ESMTP; 25 Apr 2017 15:33:07 -0700 From: Lionel Landwerlin To: intel-gfx@lists.freedesktop.org Date: Tue, 25 Apr 2017 15:32:45 -0700 Message-Id: <20170425223301.23733-14-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170425223301.23733-1-lionel.g.landwerlin@intel.com> References: <20170425223301.23733-1-lionel.g.landwerlin@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 13/29] igt/perf: allow 10% margin matching oa/sysfs freq in test_oa_exponents 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-Virus-Scanned: ClamAV using ClamSMTP From: Robert Bragg Signed-off-by: Robert Bragg Reviewed-by: Lionel Landwerlin --- tests/perf.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/perf.c b/tests/perf.c index d47e45c8..c8092eaa 100644 --- a/tests/perf.c +++ b/tests/perf.c @@ -1111,6 +1111,8 @@ test_oa_formats(void) static void test_oa_exponents(int gt_freq_mhz) { + uint32_t freq_margin; + /* This test tries to use the sysfs interface for pinning the GT * frequency so we have another point of reference for comparing with * the clock frequency as derived from OA reports. @@ -1129,11 +1131,17 @@ test_oa_exponents(int gt_freq_mhz) igt_debug("Testing OA timer exponents with requested GT frequency = %dmhz\n", gt_freq_mhz); + /* allow a +- 10% error margin when checking that the frequency + * calculated from the OA reports matches the frequency according to + * sysfs. + */ + freq_margin = gt_freq_mhz * 0.1; + /* It's asking a lot to sample with a 160 nanosecond period and the * test can fail due to buffer overflows if it wasn't possible to * keep up, so we don't start from an exponent of zero... */ - for (int i = 2; i < 20; i++) { + for (int i = 5; i < 20; i++) { uint32_t expected_timestamp_delta; uint32_t timestamp_delta; uint32_t oa_report0[64]; @@ -1157,8 +1165,10 @@ test_oa_exponents(int gt_freq_mhz) gt_freq_mhz_0 = sysfs_read("gt_act_freq_mhz"); - igt_debug("ITER %d: testing OA exponent %d with sysfs GT freq = %dmhz\n", - j, i, gt_freq_mhz_0); + igt_debug("ITER %d: testing OA exponent %d (period = %"PRIu64"ns) with sysfs GT freq = %dmhz +- %u\n", + j, i, + oa_exponent_to_ns(i), + gt_freq_mhz_0, freq_margin); open_and_read_2_oa_reports(test_oa_format, i, /* exponent */ @@ -1199,7 +1209,8 @@ test_oa_exponents(int gt_freq_mhz) igt_debug("ITER %d: time delta = %"PRIu32"(ns) clock delta = %"PRIu32" freq = %"PRIu32"(mhz)\n", j, time_delta, clock_delta, freq); - if (freq == gt_freq_mhz_1) + if (freq < (gt_freq_mhz_1 + freq_margin) && + freq > (gt_freq_mhz_1 - freq_margin)) n_freq_matches++; n_tested++;