From patchwork Mon Sep 5 20:19:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeni Dodonov X-Patchwork-Id: 1125432 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p85KMjEx000638 for ; Mon, 5 Sep 2011 20:23:05 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C34F9EB5B for ; Mon, 5 Sep 2011 13:22:45 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from oproxy9.bluehost.com (oproxy9.bluehost.com [69.89.24.6]) by gabe.freedesktop.org (Postfix) with SMTP id 735CEA090E for ; Mon, 5 Sep 2011 13:20:36 -0700 (PDT) Received: (qmail 30031 invoked by uid 0); 5 Sep 2011 20:20:36 -0000 Received: from unknown (HELO box335.bluehost.com) (69.89.31.135) by oproxy9.bluehost.com with SMTP; 5 Sep 2011 20:20:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dodonov.net; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=60xv1P/VeE0XENkMNhN6rUx+xQHghLF+N/nopCyxQIc=; b=bg2UAUoztktGgE0lIY8f4rVPUmFGb60ulvVdEJRXd2sKongXBBiZ9SixWP1DgAfP0WJpAfYx/U6zuoFm3Flt/wM/9E7ne7Vsn9s9Gx0JvbhSJikqx3m8v3Aw2dXXbUI8; Received: from 200.188.217.18.dedicated.neoviatelecom.com.br ([200.188.217.18] helo=localhost.localdomain) by box335.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1R0fel-0007ag-En; Mon, 05 Sep 2011 14:20:35 -0600 From: Eugeni Dodonov To: intel-gfx@lists.freedesktop.org Date: Mon, 5 Sep 2011 17:19:31 -0300 Message-Id: <1315253973-18950-5-git-send-email-eugeni@dodonov.net> X-Mailer: git-send-email 1.7.6.1 In-Reply-To: <1315253973-18950-1-git-send-email-eugeni@dodonov.net> References: <1315253973-18950-1-git-send-email-eugeni@dodonov.net> X-Identified-User: {669:box335.bluehost.com:dodonovn:dodonov.net} {sentby:smtp auth 200.188.217.18 authed with eugeni@dodonov.net} Cc: Eugeni Dodonov Subject: [Intel-gfx] [PATCH 4/6] intel_gpu_top: initialize monitoring statistics at startup X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 05 Sep 2011 20:23:05 +0000 (UTC) From: Eugeni Dodonov This patch initializes the last_stats[] for registers prior to starting the monitoring itself. This way, the first measure will already contain the difference from the previous value instead of non-initialized value. Signed-off-by: Eugeni Dodonov --- tools/intel_gpu_top.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index edb4a82..e2dd173 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -475,6 +475,22 @@ int main(int argc, char **argv) ring_init(&blt_ring); } + /* Initialize GPU stats */ + if (HAS_STATS_REGS(devid)) { + for (i = 0; i < STATS_COUNT; i++) { + uint32_t stats_high, stats_low, stats_high_2; + + do { + stats_high = INREG(stats_regs[i] + 4); + stats_low = INREG(stats_regs[i]); + stats_high_2 = INREG(stats_regs[i] + 4); + } while (stats_high != stats_high_2); + + last_stats[i] = (uint64_t)stats_high << 32 | + stats_low; + } + } + for (;;) { int j; unsigned long long t1, ti, tf;