mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-08 16:36:14 +00:00
igt/gem_exec_blt: Repeat measurement and average
Through away the unstable outliers for a more consistent measurement. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
cd8d3809a6
commit
c666a19e0c
@ -189,6 +189,17 @@ static uint32_t dumb_create(int fd)
|
|||||||
return arg.handle;
|
return arg.handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int dcmp(const void *A, const void *B)
|
||||||
|
{
|
||||||
|
const double *a = A, *b = B;
|
||||||
|
if (*a < *b)
|
||||||
|
return -1;
|
||||||
|
else if (*a > *b)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void run(int object_size, bool dumb)
|
static void run(int object_size, bool dumb)
|
||||||
{
|
{
|
||||||
struct drm_i915_gem_execbuffer2 execbuf;
|
struct drm_i915_gem_execbuffer2 execbuf;
|
||||||
@ -245,16 +256,26 @@ static void run(int object_size, bool dumb)
|
|||||||
|
|
||||||
for (count = 1; count <= 1<<12; count <<= 1) {
|
for (count = 1; count <= 1<<12; count <<= 1) {
|
||||||
struct timeval start, end;
|
struct timeval start, end;
|
||||||
|
const int reps = 9;
|
||||||
|
double t[reps], sum;
|
||||||
|
int n;
|
||||||
|
|
||||||
gettimeofday(&start, NULL);
|
for (n = 0; n < reps; n++) {
|
||||||
for (int loop = 0; loop < count; loop++)
|
gettimeofday(&start, NULL);
|
||||||
gem_execbuf(fd, &execbuf);
|
for (int loop = 0; loop < count; loop++)
|
||||||
gem_sync(fd, handle);
|
gem_execbuf(fd, &execbuf);
|
||||||
gettimeofday(&end, NULL);
|
gem_sync(fd, handle);
|
||||||
|
gettimeofday(&end, NULL);
|
||||||
|
t[n] = elapsed(&start, &end, count);
|
||||||
|
}
|
||||||
|
qsort(t, n, sizeof(double), dcmp);
|
||||||
|
sum = 0;
|
||||||
|
for (n = 2; n < reps - 2; n++)
|
||||||
|
sum += t[n];
|
||||||
|
sum /= reps - 4;
|
||||||
igt_info("Time to blt %d bytes x %6d: %7.3fµs, %s\n",
|
igt_info("Time to blt %d bytes x %6d: %7.3fµs, %s\n",
|
||||||
object_size, count,
|
object_size, count, sum,
|
||||||
elapsed(&start, &end, count),
|
bytes_per_sec((char *)buf, object_size/sum*1e6));
|
||||||
bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
gem_close(fd, handle);
|
gem_close(fd, handle);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user