summaryrefslogtreecommitdiff
path: root/tools/intel_gpu_top.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-07-19 08:27:32 -0700
committerEric Anholt <eric@anholt.net>2010-07-19 08:28:10 -0700
commit74c8c8d6121cda1d91df29d471e58f6b68275a1c (patch)
tree60d37739ccd79eb164f4d7d3cbb47148bdde27a5 /tools/intel_gpu_top.c
parent9e4ba53014f214750d8bba01f92bf3febf2ffb0d (diff)
intel_gpu_top: Fix the "limit printing to terminal height" again.
Diffstat (limited to 'tools/intel_gpu_top.c')
-rw-r--r--tools/intel_gpu_top.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index b82a9bd8..42ada6ed 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -365,6 +365,8 @@ int main(int argc, char **argv)
struct winsize ws;
if (ioctl(0, TIOCGWINSZ, &ws) != -1)
max_lines = ws.ws_row - 6; /* exclude header lines */
+ if (max_lines >= num_instdone_bits)
+ max_lines = num_instdone_bits;
printf("%s", clear_screen);
@@ -380,8 +382,8 @@ int main(int argc, char **argv)
(total_ring_full / SAMPLES_TO_PERCENT_RATIO) / ring_size);
printf("%30s %s\n\n", "task", "percent busy");
- for (i = 0; i < num_instdone_bits; i++) {
- if (top_bits_sorted[i]->count > 0 && i < max_lines) {
+ for (i = 0; i < max_lines; i++) {
+ if (top_bits_sorted[i]->count > 0) {
percent = top_bits_sorted[i]->count /
SAMPLES_TO_PERCENT_RATIO;
len = printf("%30s: %3d%%: ",
@@ -404,8 +406,13 @@ int main(int argc, char **argv)
break;
}
printf("\n");
+ }
+ for (i = 0; i < num_instdone_bits; i++) {
top_bits_sorted[i]->count = 0;
+
+ if (i < STATS_COUNT)
+ last_stats[i] = stats[i];
}
}