diff options
Diffstat (limited to 'tools/perf/bench/futex-lock-pi.c')
| -rw-r--r-- | tools/perf/bench/futex-lock-pi.c | 7 | 
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/bench/futex-lock-pi.c b/tools/perf/bench/futex-lock-pi.c index 936d89d30483..465012b320ee 100644 --- a/tools/perf/bench/futex-lock-pi.c +++ b/tools/perf/bench/futex-lock-pi.c @@ -75,6 +75,7 @@ static void toggle_done(int sig __maybe_unused,  static void *workerfn(void *arg)  {  	struct worker *w = (struct worker *) arg; +	unsigned long ops = w->ops;  	pthread_mutex_lock(&thread_lock);  	threads_starting--; @@ -103,9 +104,10 @@ static void *workerfn(void *arg)  		if (ret && !silent)  			warn("thread %d: Could not unlock pi-lock for %p (%d)",  			     w->tid, w->futex, ret); -		w->ops++; /* account for thread's share of work */ +		ops++; /* account for thread's share of work */  	}  while (!done); +	w->ops = ops;  	return NULL;  } @@ -150,6 +152,7 @@ int bench_futex_lock_pi(int argc, const char **argv,  		goto err;  	ncpus = sysconf(_SC_NPROCESSORS_ONLN); +	nsecs = futexbench_sanitize_numeric(nsecs);  	sigfillset(&act.sa_mask);  	act.sa_sigaction = toggle_done; @@ -157,6 +160,8 @@ int bench_futex_lock_pi(int argc, const char **argv,  	if (!nthreads)  		nthreads = ncpus; +	else +		nthreads = futexbench_sanitize_numeric(nthreads);  	worker = calloc(nthreads, sizeof(*worker));  	if (!worker)  | 
