.. | .. |
---|
35 | 35 | static bool fshared = false, done = false, silent = false; |
---|
36 | 36 | static int futex_flag = 0; |
---|
37 | 37 | |
---|
38 | | -struct timeval start, end, runtime; |
---|
| 38 | +struct timeval bench__start, bench__end, bench__runtime; |
---|
39 | 39 | static pthread_mutex_t thread_lock; |
---|
40 | 40 | static unsigned int threads_starting; |
---|
41 | 41 | static struct stats throughput_stats; |
---|
.. | .. |
---|
101 | 101 | { |
---|
102 | 102 | /* inform all threads that we're done for the day */ |
---|
103 | 103 | done = true; |
---|
104 | | - gettimeofday(&end, NULL); |
---|
105 | | - timersub(&end, &start, &runtime); |
---|
| 104 | + gettimeofday(&bench__end, NULL); |
---|
| 105 | + timersub(&bench__end, &bench__start, &bench__runtime); |
---|
106 | 106 | } |
---|
107 | 107 | |
---|
108 | 108 | static void print_summary(void) |
---|
.. | .. |
---|
112 | 112 | |
---|
113 | 113 | printf("%sAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n", |
---|
114 | 114 | !silent ? "\n" : "", avg, rel_stddev_stats(stddev, avg), |
---|
115 | | - (int) runtime.tv_sec); |
---|
| 115 | + (int)bench__runtime.tv_sec); |
---|
116 | 116 | } |
---|
117 | 117 | |
---|
118 | 118 | int bench_futex_hash(int argc, const char **argv) |
---|
.. | .. |
---|
159 | 159 | |
---|
160 | 160 | threads_starting = nthreads; |
---|
161 | 161 | pthread_attr_init(&thread_attr); |
---|
162 | | - gettimeofday(&start, NULL); |
---|
| 162 | + gettimeofday(&bench__start, NULL); |
---|
163 | 163 | for (i = 0; i < nthreads; i++) { |
---|
164 | 164 | worker[i].tid = i; |
---|
165 | 165 | worker[i].futex = calloc(nfutexes, sizeof(*worker[i].futex)); |
---|
.. | .. |
---|
202 | 202 | pthread_mutex_destroy(&thread_lock); |
---|
203 | 203 | |
---|
204 | 204 | 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; |
---|
206 | 206 | update_stats(&throughput_stats, t); |
---|
207 | 207 | if (!silent) { |
---|
208 | 208 | if (nfutexes == 1) |
---|