mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 10:26:12 +00:00
benchmarks/gem_syslatency: Subtract the clock_gettime() overhead
Since clock_gettime() should be a fixed overhead that adds to the latency result, subtract it from the result. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
2a41c4b183
commit
3e0d9ef02c
@ -226,6 +226,18 @@ static double l_estimate(igt_stats_t *stats)
|
|||||||
return igt_stats_get_mean(stats);
|
return igt_stats_get_mean(stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static double min_measurement_error(void)
|
||||||
|
{
|
||||||
|
struct timespec start, end;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||||
|
for (n = 0; n < 1024; n++)
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||||
|
|
||||||
|
return elapsed(&start, &end) / n;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct gem_busyspin *busy;
|
struct gem_busyspin *busy;
|
||||||
@ -233,6 +245,7 @@ int main(int argc, char **argv)
|
|||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
|
int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
igt_stats_t cycles, mean, max;
|
igt_stats_t cycles, mean, max;
|
||||||
|
double min;
|
||||||
int time = 10;
|
int time = 10;
|
||||||
int field = -1;
|
int field = -1;
|
||||||
int enable_gem_sysbusy = 1;
|
int enable_gem_sysbusy = 1;
|
||||||
@ -260,6 +273,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Prevent CPU sleeps so that busy and idle loads are consistent. */
|
/* Prevent CPU sleeps so that busy and idle loads are consistent. */
|
||||||
force_low_latency();
|
force_low_latency();
|
||||||
|
min = min_measurement_error();
|
||||||
|
|
||||||
busy = calloc(ncpus, sizeof(*busy));
|
busy = calloc(ncpus, sizeof(*busy));
|
||||||
if (enable_gem_sysbusy) {
|
if (enable_gem_sysbusy) {
|
||||||
@ -302,17 +316,17 @@ int main(int argc, char **argv)
|
|||||||
default:
|
default:
|
||||||
printf("gem_syslatency: cycles=%.0f, latency mean=%.3fus max=%.0fus\n",
|
printf("gem_syslatency: cycles=%.0f, latency mean=%.3fus max=%.0fus\n",
|
||||||
igt_stats_get_mean(&cycles),
|
igt_stats_get_mean(&cycles),
|
||||||
igt_stats_get_mean(&mean) / 1000,
|
(igt_stats_get_mean(&mean) - min)/ 1000,
|
||||||
l_estimate(&max) / 1000);
|
(l_estimate(&max) - min) / 1000);
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
printf("%.0f\n", igt_stats_get_mean(&cycles));
|
printf("%.0f\n", igt_stats_get_mean(&cycles));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
printf("%.3f\n", igt_stats_get_mean(&mean) / 1000);
|
printf("%.3f\n", (igt_stats_get_mean(&mean) - min) / 1000);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
printf("%.0f\n", l_estimate(&max) / 1000);
|
printf("%.0f\n", (l_estimate(&max) - min) / 1000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user