diff options
author | Eugeni Dodonov <eugeni.dodonov@intel.com> | 2011-09-05 19:35:44 -0300 |
---|---|---|
committer | Eugeni Dodonov <eugeni.dodonov@intel.com> | 2011-09-05 19:35:44 -0300 |
commit | 83047e9a5e7563bb7dd7085de5f27b55d3c2f16e (patch) | |
tree | 3e1e1d3ea4afefdea565d222790def8ae3b4074a /tools/intel_gpu_top.c | |
parent | f11f8d9aac77051a071b215910832b020d959858 (diff) |
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>
Diffstat (limited to 'tools/intel_gpu_top.c')
-rw-r--r-- | 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 2000c176..26aa1d35 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -473,6 +473,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; |