summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2019-05-22 16:57:20 +0100
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2019-05-23 15:12:13 +0100
commit7f120c5f1bff2727d50f3c392d81c0f6878b61d6 (patch)
treecf1e21049ba248abeff046d93efb6cec77eb3796 /benchmarks
parentccc473acb1eaf47f3cef9af9fec06bc53d047835 (diff)
gem_wsim: Allow random seed control
New command line option to allow controling the initial pseudo random generator seed in order to allow repeatable runs. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk> Suggested-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/gem_wsim.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index c43bbbc8..e2ffb93a 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -2946,6 +2946,7 @@ static void print_help(void)
" -t <n> Nop calibration tolerance percentage.\n"
" Use when there is a difficulty obtaining calibration with the\n"
" default settings.\n"
+" -I <n> Initial randomness seed.\n"
" -p <n> Context priority to use for the following workload on the\n"
" command line.\n"
" -w <desc|path> Filename or a workload descriptor.\n"
@@ -3119,11 +3120,9 @@ int main(int argc, char **argv)
init_clocks();
master_prng = time(NULL);
- srand(master_prng);
- master_prng = rand();
while ((c = getopt(argc, argv,
- "hqv2RsSHxGdc:n:r:w:W:a:t:b:p:")) != -1) {
+ "hqv2RsSHxGdc:n:r:w:W:a:t:b:p:I:")) != -1) {
switch (c) {
case 'W':
if (master_workload >= 0) {
@@ -3210,6 +3209,9 @@ int main(int argc, char **argv)
return 1;
}
break;
+ case 'I':
+ master_prng = strtol(optarg, NULL, 0);
+ break;
case 'h':
print_help();
return 0;
@@ -3294,6 +3296,7 @@ int main(int argc, char **argv)
clients = nr_w_args;
if (verbose > 1) {
+ printf("Random seed is %u.\n", master_prng);
printf("Using %lu nop calibration for %uus delay.\n",
nop_calibration, nop_calibration_us);
printf("%u client%s.\n", clients, clients > 1 ? "s" : "");
@@ -3312,6 +3315,9 @@ int main(int argc, char **argv)
}
}
+ srand(master_prng);
+ master_prng = rand();
+
if (master_workload >= 0 && clients == 1)
master_workload = -1;