From 8540b918665733fbc991715e3849e60e551113c9 Mon Sep 17 00:00:00 2001 From: Tvrtko Ursulin Date: Tue, 9 May 2017 09:39:17 +0100 Subject: gem_wsim: Seed random numbers per client It makes more sense for the sequence of random batch durations to be different between different clients. Also add a new command line option (-S) to enable forcing the same sequence if so can be useful for testing. Signed-off-by: Tvrtko Ursulin Suggested-by: Chris Wilson --- benchmarks/gem_wsim.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'benchmarks/gem_wsim.c') diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index 91d6fb7f..17460571 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -133,6 +133,7 @@ static int fd; #define RT (1<<3) #define VCS2REMAP (1<<4) #define INITVCSRR (1<<5) +#define SYNCEDCLIENTS (1<<6) #define VCS_SEQNO_IDX(engine) (((engine) - VCS1) * 16) #define VCS_SEQNO_OFFSET(engine) (VCS_SEQNO_IDX(engine) * sizeof(uint32_t)) @@ -925,7 +926,7 @@ run_workload(unsigned int id, struct workload *wrk, clock_gettime(CLOCK_MONOTONIC, &t_start); - hars_petruska_f54_1_random_seed(0); + hars_petruska_f54_1_random_seed((flags & SYNCEDCLIENTS) ? 0 : id); for (j = 0; run && (background || j < repeat); j++) { clock_gettime(CLOCK_MONOTONIC, &wrk->repeat_start); @@ -1129,6 +1130,8 @@ static void print_help(void) " -b Load balancing to use. (0: rr, 1: qd, 2: rt, 3: rtr)\n" " -2 Remap VCS2 to BCS.\n" " -R Round-robin initial VCS assignment per client.\n" +" -S Synchronize the sequence of random batch durations\n" +" between clients.\n" ); } @@ -1193,7 +1196,7 @@ int main(int argc, char **argv) fd = drm_open_driver(DRIVER_INTEL); intel_register_access_init(intel_get_pci_device(), false, fd); - while ((c = getopt(argc, argv, "q2Rc:n:r:xw:W:t:b:h")) != -1) { + while ((c = getopt(argc, argv, "q2RSc:n:r:xw:W:t:b:h")) != -1) { switch (c) { case 'W': if (master_workload >= 0) { @@ -1231,6 +1234,9 @@ int main(int argc, char **argv) case 'R': flags |= INITVCSRR; break; + case 'S': + flags |= SYNCEDCLIENTS; + break; case 'b': switch (strtol(optarg, NULL, 0)) { case 0: -- cgit v1.2.3