Re: [PATCH i-g-t] benchmarks/gem_wsim: Randomise random seed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 16/05/2019 19:58, Chris Wilson wrote:
To avoid hitting the same rut on each benchmark run, start with a new
random seed. To allow hitting the same rut again, let it be specified
by the user.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
---
  benchmarks/gem_wsim.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 48568ce40..cf2a44746 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -2282,8 +2282,9 @@ int main(int argc, char **argv)
  	igt_require(fd);
init_clocks();
+	srand(time(NULL));
- while ((c = getopt(argc, argv, "hqv2RSHxGdc:n:r:w:W:a:t:b:p:")) != -1) {
+	while ((c = getopt(argc, argv, "hqv2RSHxGdc:n:r:w:W:a:t:b:p:s:")) != -1) {
  		switch (c) {
  		case 'W':
  			if (master_workload >= 0) {
@@ -2300,6 +2301,9 @@ int main(int argc, char **argv)
  		case 'p':
  			prio = atoi(optarg);
  			break;
+		case 's':
+			srand(atoi(optarg));
+			break;
  		case 'a':
  			if (append_workload_arg) {
  				if (verbose)


Makes sense, just the help text missing.

I was initially confused at srand when I thought I used your hars_petruska library routines but then saw rand() feeds the seed into those.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux