.. | .. |
---|
35 | 35 | static bool done = false, fshared = false; |
---|
36 | 36 | static unsigned int nthreads = 0; |
---|
37 | 37 | static int futex_flag = 0; |
---|
38 | | -struct timeval start, end, runtime; |
---|
39 | 38 | static pthread_mutex_t thread_lock; |
---|
40 | 39 | static unsigned int threads_starting; |
---|
41 | 40 | static struct stats throughput_stats; |
---|
.. | .. |
---|
62 | 61 | |
---|
63 | 62 | printf("%sAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n", |
---|
64 | 63 | !silent ? "\n" : "", avg, rel_stddev_stats(stddev, avg), |
---|
65 | | - (int) runtime.tv_sec); |
---|
| 64 | + (int)bench__runtime.tv_sec); |
---|
66 | 65 | } |
---|
67 | 66 | |
---|
68 | 67 | static void toggle_done(int sig __maybe_unused, |
---|
.. | .. |
---|
71 | 70 | { |
---|
72 | 71 | /* inform all threads that we're done for the day */ |
---|
73 | 72 | done = true; |
---|
74 | | - gettimeofday(&end, NULL); |
---|
75 | | - timersub(&end, &start, &runtime); |
---|
| 73 | + gettimeofday(&bench__end, NULL); |
---|
| 74 | + timersub(&bench__end, &bench__start, &bench__runtime); |
---|
76 | 75 | } |
---|
77 | 76 | |
---|
78 | 77 | static void *workerfn(void *arg) |
---|
.. | .. |
---|
183 | 182 | |
---|
184 | 183 | threads_starting = nthreads; |
---|
185 | 184 | pthread_attr_init(&thread_attr); |
---|
186 | | - gettimeofday(&start, NULL); |
---|
| 185 | + gettimeofday(&bench__start, NULL); |
---|
187 | 186 | |
---|
188 | 187 | create_threads(worker, thread_attr, cpu); |
---|
189 | 188 | pthread_attr_destroy(&thread_attr); |
---|
.. | .. |
---|
209 | 208 | pthread_mutex_destroy(&thread_lock); |
---|
210 | 209 | |
---|
211 | 210 | for (i = 0; i < nthreads; i++) { |
---|
212 | | - unsigned long t = worker[i].ops/runtime.tv_sec; |
---|
| 211 | + unsigned long t = worker[i].ops / bench__runtime.tv_sec; |
---|
213 | 212 | |
---|
214 | 213 | update_stats(&throughput_stats, t); |
---|
215 | 214 | if (!silent) |
---|