summaryrefslogtreecommitdiff
path: root/benchmarks/gem_wsim.c
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2017-05-16 11:46:50 +0100
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2017-05-16 11:46:50 +0100
commit3e622a8f9222f4a670b5365111ddf85b1fb4afa7 (patch)
tree5ebbb5edf0392dd4e2489ed378a07295142cf1d2 /benchmarks/gem_wsim.c
parenta47419f95c67665ae67b22de70346ec0a99c7b84 (diff)
gem_wsync: Clearer step metadata handling
Introduce an anonymous union so each step type can use its own name for the metadata. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'benchmarks/gem_wsim.c')
-rw-r--r--benchmarks/gem_wsim.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 840353e5..a307e95d 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -92,7 +92,14 @@ struct w_step
struct deps data_deps;
struct deps fence_deps;
int emit_fence;
- int wait;
+ union {
+ int sync;
+ int delay;
+ int period;
+ int target;
+ int throttle;
+ int fence_signal;
+ };
/* Implementation details */
unsigned int idx;
@@ -268,7 +275,7 @@ parse_workload(char *_desc, unsigned int flags, struct workload *app_w)
}
step.type = DELAY;
- step.wait = tmp;
+ step.delay = tmp;
goto add_step;
}
} else if (!strcasecmp(field, "p")) {
@@ -284,7 +291,7 @@ parse_workload(char *_desc, unsigned int flags, struct workload *app_w)
}
step.type = PERIOD;
- step.wait = tmp;
+ step.period = tmp;
goto add_step;
}
} else if (!strcasecmp(field, "s")) {
@@ -301,7 +308,7 @@ parse_workload(char *_desc, unsigned int flags, struct workload *app_w)
}
step.type = SYNC;
- step.wait = tmp;
+ step.target = tmp;
goto add_step;
}
} else if (!strcasecmp(field, "t")) {
@@ -317,7 +324,7 @@ parse_workload(char *_desc, unsigned int flags, struct workload *app_w)
}
step.type = THROTTLE;
- step.wait = tmp;
+ step.throttle = tmp;
goto add_step;
}
} else if (!strcasecmp(field, "q")) {
@@ -333,7 +340,7 @@ parse_workload(char *_desc, unsigned int flags, struct workload *app_w)
}
step.type = QD_THROTTLE;
- step.wait = tmp;
+ step.throttle = tmp;
goto add_step;
}
}
@@ -435,7 +442,7 @@ parse_workload(char *_desc, unsigned int flags, struct workload *app_w)
nr_steps);
return NULL;
}
- step.wait = field[0] - '0';
+ step.sync = field[0] - '0';
valid++;
}
@@ -1354,12 +1361,12 @@ run_workload(unsigned int id, struct workload *wrk,
int do_sleep = 0;
if (w->type == DELAY) {
- do_sleep = w->wait;
+ do_sleep = w->delay;
} else if (w->type == PERIOD) {
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
- do_sleep = w->wait -
+ do_sleep = w->period -
elapsed_us(&wrk->repeat_start, &now);
if (do_sleep < 0) {
if (verbose > 1)
@@ -1368,17 +1375,17 @@ run_workload(unsigned int id, struct workload *wrk,
continue;
}
} else if (w->type == SYNC) {
- unsigned int s_idx = i + w->wait;
+ unsigned int s_idx = i + w->target;
igt_assert(i > 0 && i < wrk->nr_steps);
igt_assert(wrk->steps[s_idx].type == BATCH);
gem_sync(fd, wrk->steps[s_idx].obj[0].handle);
continue;
} else if (w->type == THROTTLE) {
- throttle = w->wait;
+ throttle = w->throttle;
continue;
} else if (w->type == QD_THROTTLE) {
- qd_throttle = w->wait;
+ qd_throttle = w->throttle;
continue;
}
@@ -1419,7 +1426,7 @@ run_workload(unsigned int id, struct workload *wrk,
}
}
- if (w->wait) {
+ if (w->sync) {
gem_sync(fd, w->obj[0].handle);
if (flags & HEARTBEAT)
init_status_page(wrk, 0);