summaryrefslogtreecommitdiff
path: root/benchmarks/gem_latency.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-12-19 11:36:37 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-12-19 12:16:52 +0000
commite37a4c80922aaeb79a419a7d7f96b0ac4c6ffb88 (patch)
tree9c65dc5e0be1c26839ad2bfbe92415f7c9e877fe /benchmarks/gem_latency.c
parent2ef368acfa5c3863543663f03c3eb26fba93cca6 (diff)
benchmarks/gem_latency: Add time control
Allow the user to choose a time to run for, default 10s Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks/gem_latency.c')
-rw-r--r--benchmarks/gem_latency.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/benchmarks/gem_latency.c b/benchmarks/gem_latency.c
index 493563b7..2571b65a 100644
--- a/benchmarks/gem_latency.c
+++ b/benchmarks/gem_latency.c
@@ -279,7 +279,8 @@ static double l_estimate(igt_stats_t *stats)
}
#define CONTEXT 1
-static int run(int nproducers,
+static int run(int seconds,
+ int nproducers,
int nconsumers,
int nop,
int workload,
@@ -336,7 +337,7 @@ static int run(int nproducers,
for (n = 0; n < nproducers; n++)
pthread_create(&p[n].thread, NULL, producer, &p[n]);
- sleep(10);
+ sleep(seconds);
done = true;
nrun = complete = 0;
@@ -369,6 +370,7 @@ static int run(int nproducers,
int main(int argc, char **argv)
{
+ int time = 10;
int producers = 1;
int consumers = 0;
int nop = 0;
@@ -376,7 +378,7 @@ int main(int argc, char **argv)
unsigned flags = 0;
int c;
- while ((c = getopt(argc, argv, "p:c:n:w:s")) != -1) {
+ while ((c = getopt(argc, argv, "p:c:n:w:t:s")) != -1) {
switch (c) {
case 'p':
/* How many threads generate work? */
@@ -406,6 +408,13 @@ int main(int argc, char **argv)
workload = 1;
break;
+ case 't':
+ /* How long to run the benchmark for (seconds) */
+ time = atoi(optarg);
+ if (time < 1)
+ time = 1;
+ break;
+
case 's':
/* Assign each producer to its own context, adding
* context switching into the mix (e.g. execlists
@@ -421,5 +430,5 @@ int main(int argc, char **argv)
}
}
- return run(producers, consumers, nop, workload, flags);
+ return run(time, producers, consumers, nop, workload, flags);
}