MCPcopy Create free account
hub / github.com/apache/impala / TimeParallelExecutors

Function TimeParallelExecutors

be/src/benchmarks/thread-create-benchmark.cc:106–124  ·  view source on GitHub ↗

Times how long it takes to run num_threads 'executors', each of which spawns num_threads_per_executor empty threads, and to wait for all of them to finish.

Source from the content-addressed store, hash-verified

104// which spawns num_threads_per_executor empty threads, and to wait
105// for all of them to finish.
106void TimeParallelExecutors(int num_threads, int num_threads_per_executor,
107 bool use_native_threads = true) {
108 StopWatch sw;
109 sw.Start();
110 if (use_native_threads) {
111 function<void ()> f =
112 bind(NativeThreadStarter, num_threads_per_executor, EmptyThread);
113 NativeThreadStarter(num_threads, f);
114 } else {
115 function<void ()> f =
116 bind(ImpalaThreadStarter, num_threads_per_executor, EmptyThread);
117 ImpalaThreadStarter(num_threads, f);
118 }
119 sw.Stop();
120 cout << (use_native_threads ? "(Native):" : "(Impala):")
121 << "Time to start up " << num_threads << " * " << num_threads_per_executor << " = "
122 << num_threads * num_threads_per_executor << " threads: "
123 << PrettyPrinter::Print(sw.ElapsedTime(), TUnit::CPU_TICKS) << endl;
124}
125
126int main(int argc, char **argv) {
127 google::InitGoogleLogging(argv[0]);

Callers 1

mainFunction · 0.85

Calls 6

bindFunction · 0.85
NativeThreadStarterFunction · 0.85
ImpalaThreadStarterFunction · 0.70
StartMethod · 0.45
StopMethod · 0.45
ElapsedTimeMethod · 0.45

Tested by

no test coverage detected