summaryrefslogtreecommitdiff
path: root/benchmarks/gem_latency.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-12-19 10:52:12 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-12-19 12:16:52 +0000
commit1db5b05243c0d0e84af4fc2845fc320aa5787436 (patch)
tree9b9073a61eaa48dda1cbc9668ec605b7bb98dc8d /benchmarks/gem_latency.c
parent6dbe0a301223f177ef80078c5ffdbf8575a8bae1 (diff)
benchmarks/gem_latency: Expose the workload factor
Allow the user to select how many batches each producer submits before waiting. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks/gem_latency.c')
-rw-r--r--benchmarks/gem_latency.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/benchmarks/gem_latency.c b/benchmarks/gem_latency.c
index f6ef97f9..d309de9e 100644
--- a/benchmarks/gem_latency.c
+++ b/benchmarks/gem_latency.c
@@ -67,6 +67,7 @@ struct producer {
int complete;
igt_stats_t latency, throughput;
+ int workload;
int nconsumers;
struct consumer *consumers;
};
@@ -76,8 +77,8 @@ struct producer {
#define BLT_WRITE_ALPHA (1<<21)
#define BLT_WRITE_RGB (1<<20)
-#define WIDTH 256
-#define HEIGHT 256
+#define WIDTH 128
+#define HEIGHT 128
#define BCS_TIMESTAMP (0x22000 + 0x358)
@@ -173,7 +174,7 @@ static void *producer(void *arg)
while (!done) {
uint32_t start = READ(BCS_TIMESTAMP);
- int batches = 10;
+ int batches = p->workload;
while (batches--)
gem_execbuf(fd, &execbuf);
@@ -229,7 +230,7 @@ static double l_estimate(igt_stats_t *stats)
}
#define CONTEXT 1
-static int run(int nproducers, int nconsumers, unsigned flags)
+static int run(int nproducers, int nconsumers, int workload, unsigned flags)
{
struct producer *p;
igt_stats_t latency, throughput;
@@ -260,6 +261,7 @@ static int run(int nproducers, int nconsumers, unsigned flags)
igt_stats_init(&p[n].latency);
igt_stats_init(&p[n].throughput);
p[n].wait = nconsumers;
+ p[n].workload = workload;
p[n].nconsumers = nconsumers;
p[n].consumers = calloc(nconsumers, sizeof(struct consumer));
for (m = 0; m < nconsumers; m++) {
@@ -308,17 +310,28 @@ int main(int argc, char **argv)
{
int producers = 8;
int consumers = 1;
+ int workload = 10;
unsigned flags = 0;
int c;
- while ((c = getopt (argc, argv, "p:c:sa")) != -1) {
+ while ((c = getopt (argc, argv, "p:c:w:s")) != -1) {
switch (c) {
case 'p':
producers = atoi(optarg);
+ if (producers < 1)
+ producers = 1;
break;
case 'c':
consumers = atoi(optarg);
+ if (consumers < 0)
+ consumers = 0;
+ break;
+
+ case 'w':
+ workload = atoi(optarg);
+ if (workload < 1)
+ workload = 1;
break;
case 's':
@@ -330,5 +343,5 @@ int main(int argc, char **argv)
}
}
- return run(producers, consumers, flags);
+ return run(producers, consumers, workload, flags);
}