hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/tools/perf/bench/futex-hash.c
....@@ -35,7 +35,7 @@
3535 static bool fshared = false, done = false, silent = false;
3636 static int futex_flag = 0;
3737
38
-struct timeval start, end, runtime;
38
+struct timeval bench__start, bench__end, bench__runtime;
3939 static pthread_mutex_t thread_lock;
4040 static unsigned int threads_starting;
4141 static struct stats throughput_stats;
....@@ -101,8 +101,8 @@
101101 {
102102 /* inform all threads that we're done for the day */
103103 done = true;
104
- gettimeofday(&end, NULL);
105
- timersub(&end, &start, &runtime);
104
+ gettimeofday(&bench__end, NULL);
105
+ timersub(&bench__end, &bench__start, &bench__runtime);
106106 }
107107
108108 static void print_summary(void)
....@@ -112,7 +112,7 @@
112112
113113 printf("%sAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n",
114114 !silent ? "\n" : "", avg, rel_stddev_stats(stddev, avg),
115
- (int) runtime.tv_sec);
115
+ (int)bench__runtime.tv_sec);
116116 }
117117
118118 int bench_futex_hash(int argc, const char **argv)
....@@ -159,7 +159,7 @@
159159
160160 threads_starting = nthreads;
161161 pthread_attr_init(&thread_attr);
162
- gettimeofday(&start, NULL);
162
+ gettimeofday(&bench__start, NULL);
163163 for (i = 0; i < nthreads; i++) {
164164 worker[i].tid = i;
165165 worker[i].futex = calloc(nfutexes, sizeof(*worker[i].futex));
....@@ -202,7 +202,7 @@
202202 pthread_mutex_destroy(&thread_lock);
203203
204204 for (i = 0; i < nthreads; i++) {
205
- unsigned long t = worker[i].ops/runtime.tv_sec;
205
+ unsigned long t = worker[i].ops / bench__runtime.tv_sec;
206206 update_stats(&throughput_stats, t);
207207 if (!silent) {
208208 if (nfutexes == 1)