From 26a5e655883f2b0a2ff903cb24e40d6e2570dbe3 Mon Sep 17 00:00:00 2001 From: Tvrtko Ursulin Date: Tue, 16 May 2017 08:11:29 +0100 Subject: gem_wsim: Simplify batch offset block a bit Just compact it a bit by avoiding the min != max check duplication and change get_duration to change w_step. Signed-off-by: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'benchmarks/gem_wsim.c') diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index 93ffc1f2..5cf59a68 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -497,8 +497,10 @@ clone_workload(struct workload *_wrk) #define PAGE_SIZE (4096) #endif -static unsigned int get_duration(struct duration *dur) +static unsigned int get_duration(struct w_step *w) { + struct duration *dur = &w->duration; + if (dur->min == dur->max) return dur->min; else @@ -1306,14 +1308,9 @@ run_workload(unsigned int id, struct workload *wrk, if (flags & RT) update_bb_rt(w, engine, wrk->seqno[engine]); - if (w->duration.min != w->duration.max) { - unsigned int d = get_duration(&w->duration); - unsigned long offset; - - offset = ALIGN(w->bb_sz - get_bb_sz(d), - 2 * sizeof(uint32_t)); - w->eb.batch_start_offset = offset; - } + w->eb.batch_start_offset = + ALIGN(w->bb_sz - get_bb_sz(get_duration(w)), + 2 * sizeof(uint32_t)); if (throttle > 0) w_sync_to(wrk, w, i - throttle); -- cgit v1.2.3