From: Chris Wilson Date: Tue, 27 Aug 2013 16:35:51 +0000 (+0100) Subject: overlay: Tidy presentation of ring busy values X-Git-Tag: intel-gpu-tools-1.4~77 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=177208b0d4cf64a3e2f18909a47afc5bd646a651;p=platform%2Fupstream%2Fintel-gpu-tools.git overlay: Tidy presentation of ring busy values Signed-off-by: Chris Wilson --- diff --git a/overlay/gpu-top.c b/overlay/gpu-top.c index 1efbbfd..7716695 100644 --- a/overlay/gpu-top.c +++ b/overlay/gpu-top.c @@ -292,11 +292,19 @@ int gpu_top_update(struct gpu_top *gt) d_time = s->time - d->time; for (n = 0; n < gt->num_rings; n++) { - gt->ring[n].u.u.busy = 100 * (s->busy[n] - d->busy[n]) / d_time; + gt->ring[n].u.u.busy = (100 * (s->busy[n] - d->busy[n]) + d_time/2) / d_time; if (gt->have_wait) - gt->ring[n].u.u.wait = 100 * (s->wait[n] - d->wait[n]) / d_time; + gt->ring[n].u.u.wait = (100 * (s->wait[n] - d->wait[n]) + d_time/2) / d_time; if (gt->have_sema) - gt->ring[n].u.u.sema = 100 * (s->sema[n] - d->sema[n]) / d_time; + gt->ring[n].u.u.sema = (100 * (s->sema[n] - d->sema[n]) + d_time/2) / d_time; + + /* in case of rounding + sampling errors, fudge */ + if (gt->ring[n].u.u.busy > 100) + gt->ring[n].u.u.busy = 100; + if (gt->ring[n].u.u.wait > 100) + gt->ring[n].u.u.wait = 100; + if (gt->ring[n].u.u.sema > 100) + gt->ring[n].u.u.sema = 100; } update = 1;