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>
This commit is contained in:
Robert Bragg 2009-04-17 16:25:52 +01:00 committed by Eric Anholt
parent 2a50faae7e
commit 2f0c0aa8ae

View File

@ -31,7 +31,10 @@
#include <err.h> #include <err.h>
#include "intel_gpu_tools.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 { struct top_bit {
/* initial setup */ /* initial setup */
@ -247,7 +250,7 @@ int main(int argc, char **argv)
int total_ring_full = 0; int total_ring_full = 0;
int ring_idle = 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; uint32_t ring_head, ring_tail;
int ring_full; int ring_full;
@ -271,7 +274,7 @@ int main(int argc, char **argv)
total_ring_full += ring_full; total_ring_full += ring_full;
usleep(10000); usleep(1000000 / SAMPLES_PER_SEC);
} }
qsort(top_bits_sorted, num_top_bits, sizeof(struct top_bit *), qsort(top_bits_sorted, num_top_bits, sizeof(struct top_bit *),
@ -282,17 +285,17 @@ int main(int argc, char **argv)
print_clock_info(); print_clock_info();
printf("ring idle: %3d%% ring space: %d/%d (%d%%)\n", printf("ring idle: %3d%% ring space: %d/%d (%d%%)\n",
ring_idle, ring_idle / SAMPLES_TO_PERCENT_RATIO,
total_ring_full / 100, ring_size, total_ring_full / SAMPLES_PER_SEC, ring_size,
total_ring_full / 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_top_bits; i++) { for (i = 0; i < num_top_bits; i++) {
if (top_bits_sorted[i]->count == 0) if (top_bits_sorted[i]->count < 1)
break; break;
printf("%30s: %d%%\n", printf("%30s: %d%%\n",
top_bits_sorted[i]->name, 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; top_bits_sorted[i]->count = 0;
} }