mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 01:46:14 +00:00
intel_gpu_top: Fix the "limit printing to terminal height" again.
This commit is contained in:
parent
9e4ba53014
commit
74c8c8d612
@ -365,6 +365,8 @@ int main(int argc, char **argv)
|
|||||||
struct winsize ws;
|
struct winsize ws;
|
||||||
if (ioctl(0, TIOCGWINSZ, &ws) != -1)
|
if (ioctl(0, TIOCGWINSZ, &ws) != -1)
|
||||||
max_lines = ws.ws_row - 6; /* exclude header lines */
|
max_lines = ws.ws_row - 6; /* exclude header lines */
|
||||||
|
if (max_lines >= num_instdone_bits)
|
||||||
|
max_lines = num_instdone_bits;
|
||||||
|
|
||||||
printf("%s", clear_screen);
|
printf("%s", clear_screen);
|
||||||
|
|
||||||
@ -380,8 +382,8 @@ int main(int argc, char **argv)
|
|||||||
(total_ring_full / SAMPLES_TO_PERCENT_RATIO) / ring_size);
|
(total_ring_full / SAMPLES_TO_PERCENT_RATIO) / ring_size);
|
||||||
|
|
||||||
printf("%30s %s\n\n", "task", "percent busy");
|
printf("%30s %s\n\n", "task", "percent busy");
|
||||||
for (i = 0; i < num_instdone_bits; i++) {
|
for (i = 0; i < max_lines; i++) {
|
||||||
if (top_bits_sorted[i]->count > 0 && i < max_lines) {
|
if (top_bits_sorted[i]->count > 0) {
|
||||||
percent = top_bits_sorted[i]->count /
|
percent = top_bits_sorted[i]->count /
|
||||||
SAMPLES_TO_PERCENT_RATIO;
|
SAMPLES_TO_PERCENT_RATIO;
|
||||||
len = printf("%30s: %3d%%: ",
|
len = printf("%30s: %3d%%: ",
|
||||||
@ -404,8 +406,13 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < num_instdone_bits; i++) {
|
||||||
top_bits_sorted[i]->count = 0;
|
top_bits_sorted[i]->count = 0;
|
||||||
|
|
||||||
|
if (i < STATS_COUNT)
|
||||||
|
last_stats[i] = stats[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user