From patchwork Mon May 18 15:35:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 6430011 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DCCD79F3D1 for ; Mon, 18 May 2015 15:35:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14FEF20571 for ; Mon, 18 May 2015 15:35:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0B48F205C1 for ; Mon, 18 May 2015 15:35:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 34F966E4F8; Mon, 18 May 2015 08:35:49 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 001C16E4BE for ; Mon, 18 May 2015 08:35:47 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 18 May 2015 08:35:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,453,1427785200"; d="scan'208";a="495100137" Received: from ideak-desk.fi.intel.com ([10.237.72.74]) by FMSMGA003.fm.intel.com with ESMTP; 18 May 2015 08:35:48 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org Date: Mon, 18 May 2015 18:35:35 +0300 Message-Id: <1431963339-23914-3-git-send-email-imre.deak@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431963339-23914-1-git-send-email-imre.deak@intel.com> References: <1431963339-23914-1-git-send-email-imre.deak@intel.com> Subject: [Intel-gfx] [PATCH 3/7] tests/pm_rc6_residency: factor out the code to measure residencies 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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 The upcoming patches will add some additional logic around reading out the counter values, so factor out the readout code to prepare for those patches. No functional change. Signed-off-by: Imre Deak --- tests/pm_rc6_residency.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c index ed20d3e..14573eb 100644 --- a/tests/pm_rc6_residency.c +++ b/tests/pm_rc6_residency.c @@ -38,6 +38,13 @@ #define SLEEP_DURATION 3000 // in milliseconds #define CODE_TIME 50 // in microseconfs +struct residencies { + int rc6; + int media_rc6; + int rc6p; + int rc6pp; +}; + static unsigned int readit(const char *path) { unsigned int ret; @@ -102,11 +109,23 @@ static void residency_accuracy(unsigned int diff, "Sysfs RC6 residency counter is inaccurate.\n"); } +static void measure_residencies(int devid, struct residencies *res) +{ + res->rc6 = read_rc6_residency("rc6"); + if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid)) + res->media_rc6 = read_rc6_residency("media_rc6"); + + if (IS_GEN6(devid) || IS_IVYBRIDGE(devid)) { + res->rc6p = read_rc6_residency("rc6p"); + res->rc6pp = read_rc6_residency("rc6pp"); + } +} + igt_main { int fd; int devid = 0; - int rc6, rc6p, rc6pp, media; + struct residencies res; igt_skip_on_simulation(); @@ -116,29 +135,22 @@ igt_main devid = intel_get_drm_devid(fd); close(fd); - rc6 = read_rc6_residency("rc6"); - if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid)) - media = read_rc6_residency("media_rc6"); - - if (IS_GEN6(devid) || IS_IVYBRIDGE(devid)) { - rc6p = read_rc6_residency("rc6p"); - rc6pp = read_rc6_residency("rc6pp"); - } + measure_residencies(devid, &res); } igt_subtest("rc6-accuracy") - residency_accuracy(rc6, "rc6"); + residency_accuracy(res.rc6, "rc6"); igt_subtest("media-rc6-accuracy") if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid)) - residency_accuracy(media, "media_rc6"); + residency_accuracy(res.media_rc6, "media_rc6"); igt_subtest("rc6p-accuracy") { if (!IS_GEN6(devid) && !IS_IVYBRIDGE(devid)) igt_skip("This platform doesn't support RC6p\n"); - residency_accuracy(rc6p, "rc6p"); + residency_accuracy(res.rc6p, "rc6p"); } igt_subtest("rc6pp-accuracy") { if (!IS_GEN6(devid) && !IS_IVYBRIDGE(devid)) igt_skip("This platform doesn't support RC6pp\n"); - residency_accuracy(rc6pp, "rc6pp"); + residency_accuracy(res.rc6pp, "rc6pp"); } }