summaryrefslogtreecommitdiff
path: root/tools/intel_gpu_top.c
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2009-04-17 16:25:52 +0100
committerEric Anholt <eric@anholt.net>2009-06-09 11:31:24 -0700
commit2f0c0aa8ae0649e8b05d74fed9115a4a62aa7e7f (patch)
tree9c3afaba9847faee5fb9efb825112a61b2a36698 /tools/intel_gpu_top.c
parent2a50faae7e9d674dac60b51101aa8bf653a0b7a3 (diff)
Increases the sample frequency from 100/sec to 10,000/sec
For a typical vsync locked application running at 60fps, sampling at just under twice a frame doesn't seem to give very stable lists of relevent hardware units because there are a number of units involved that may not be sampled one second to the next. This bumps the sample rate to 10,000 instead which is ~ 170 samples per frame so we tend to hit all the units involved. It also changes the report threshold to a sample count >= 1, so you don't see as many units with a percentage of 0. Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'tools/intel_gpu_top.c')
-rw-r--r--tools/intel_gpu_top.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 538b9eea..a965725b 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -31,7 +31,10 @@
#include <err.h>
#include "intel_gpu_tools.h"
-#define MAX_NUM_TOP_BITS 100
+#define SAMPLES_PER_SEC 10000
+#define SAMPLES_TO_PERCENT_RATIO (SAMPLES_PER_SEC / 100)
+
+#define MAX_NUM_TOP_BITS 100
struct top_bit {
/* initial setup */
@@ -247,7 +250,7 @@ int main(int argc, char **argv)
int total_ring_full = 0;
int ring_idle = 0;
- for (i = 0; i < 100; i++) {
+ for (i = 0; i < SAMPLES_PER_SEC; i++) {
uint32_t ring_head, ring_tail;
int ring_full;
@@ -271,7 +274,7 @@ int main(int argc, char **argv)
total_ring_full += ring_full;
- usleep(10000);
+ usleep(1000000 / SAMPLES_PER_SEC);
}
qsort(top_bits_sorted, num_top_bits, sizeof(struct top_bit *),
@@ -282,17 +285,17 @@ int main(int argc, char **argv)
print_clock_info();
printf("ring idle: %3d%% ring space: %d/%d (%d%%)\n",
- ring_idle,
- total_ring_full / 100, ring_size,
- total_ring_full / ring_size);
+ ring_idle / SAMPLES_TO_PERCENT_RATIO,
+ total_ring_full / SAMPLES_PER_SEC, ring_size,
+ (total_ring_full / SAMPLES_TO_PERCENT_RATIO) / ring_size);
printf("%30s %s\n\n", "task", "percent busy");
for (i = 0; i < num_top_bits; i++) {
- if (top_bits_sorted[i]->count == 0)
+ if (top_bits_sorted[i]->count < 1)
break;
printf("%30s: %d%%\n",
top_bits_sorted[i]->name,
- top_bits_sorted[i]->count);
+ top_bits_sorted[i]->count / SAMPLES_TO_PERCENT_RATIO);
top_bits_sorted[i]->count = 0;
}