All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eugeni Dodonov <eugeni@dodonov.net>
To: intel-gfx@lists.freedesktop.org
Cc: Eugeni Dodonov <eugeni.dodonov@intel.com>
Subject: [PATCH 4/6] intel_gpu_top: initialize monitoring statistics at startup
Date: Mon,  5 Sep 2011 17:19:31 -0300	[thread overview]
Message-ID: <1315253973-18950-5-git-send-email-eugeni@dodonov.net> (raw)
In-Reply-To: <1315253973-18950-1-git-send-email-eugeni@dodonov.net>

From: Eugeni Dodonov <eugeni.dodonov@intel.com>

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 <eugeni.dodonov@intel.com>
---
 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;
-- 
1.7.6.1

  parent reply	other threads:[~2011-09-05 20:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-05 20:19 [PATCH 0/6] additional intel_gpu_top profiling features Eugeni Dodonov
2011-09-05 20:19 ` [PATCH 1/6] intel_gpu_top: account for time spent in syscalls Eugeni Dodonov
2011-09-05 20:19 ` [PATCH 2/6] intel_gpu_top: suport command line parameters and variable samples per second Eugeni Dodonov
2011-09-05 21:44   ` Chris Wilson
2011-09-05 22:16     ` Eugeni Dodonov
2011-09-05 20:19 ` [PATCH 3/6] intel_gpu_tool: initial support for non-screen output Eugeni Dodonov
2011-09-05 22:56   ` Łukasz Kuryło
2011-09-05 23:48     ` Łukasz Kuryło
2011-09-06  0:05     ` Eugeni Dodonov
2011-09-05 20:19 ` Eugeni Dodonov [this message]
2011-09-05 20:19 ` [PATCH 5/6] intel_gpu_top: support non-interactive mode Eugeni Dodonov
2011-09-05 20:19 ` [PATCH 6/6] intel_gpu_top: support profiling user-specified commands Eugeni Dodonov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315253973-18950-5-git-send-email-eugeni@dodonov.net \
    --to=eugeni@dodonov.net \
    --cc=eugeni.dodonov@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.