Runs 'num_threads' Impala Threads and have each of them execute func().
| 106 | |
| 107 | // Runs 'num_threads' Impala Threads and have each of them execute func(). |
| 108 | void ImpalaThreadStarter(void (*func) (const TUniqueId&, int), int num_threads, |
| 109 | int func_arg) { |
| 110 | vector<unique_ptr<Thread>> threads; |
| 111 | threads.reserve(num_threads); |
| 112 | |
| 113 | for (int i=0; i < num_threads; ++i) { |
| 114 | unique_ptr<Thread> thread; |
| 115 | function<void ()> f = |
| 116 | bind(func, query_ids[i], func_arg); |
| 117 | Status s = |
| 118 | Thread::Create("mythreadgroup", "thread", f, &thread); |
| 119 | DCHECK(s.ok()); |
| 120 | threads.push_back(move(thread)); |
| 121 | } |
| 122 | for (unique_ptr<Thread>& thread: threads) { |
| 123 | thread->Join(); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | void RunBenchmark(int num_queries, int num_accesses) { |
| 128 | StopWatch total_time; |