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

Function main

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

Source from the content-addressed store, hash-verified

124}
125
126int main(int argc, char **argv) {
127 google::InitGoogleLogging(argv[0]);
128 CpuInfo::Init();
129 impala::InitThreading();
130
131 cout << "-----------------Benchmark 1: Single-threaded thread creation" << endl;
132
133 // Measure how long it takes to start up a bunch of threads
134 StopWatch total_time;
135 total_time.Start();
136
137 TimeParallelExecutors(1, 1);
138 TimeParallelExecutors(1, 5);
139 TimeParallelExecutors(1, 50);
140 TimeParallelExecutors(1, 500);
141 TimeParallelExecutors(1, 5000);
142
143 total_time.Stop();
144
145 cout << "Total time (Native): "
146 << PrettyPrinter::Print(total_time.ElapsedTime(), TUnit::CPU_TICKS)
147 << endl << endl;
148
149 // Measure how long it takes to start up a bunch of threads
150 StopWatch total_time_imp;
151 total_time_imp.Start();
152
153 TimeParallelExecutors(1, 1, false);
154 TimeParallelExecutors(1, 5, false);
155 TimeParallelExecutors(1, 50, false);
156 TimeParallelExecutors(1, 500, false);
157 TimeParallelExecutors(1, 5000, false);
158
159 total_time_imp.Stop();
160
161 cout << "Total time (IMPALA): "
162 << PrettyPrinter::Print(total_time_imp.ElapsedTime(), TUnit::CPU_TICKS)
163 << endl << endl;
164
165 int64_t difference = total_time_imp.ElapsedTime() - total_time.ElapsedTime();
166 cout << "Impala thread overhead: "
167 << PrettyPrinter::Print(difference, TUnit::CPU_TICKS)
168 << ", which is " << (difference * 100.0 / total_time.ElapsedTime())
169 << "%" << endl << endl;
170
171
172 cout << "-----------------Benchmark 2: Multi-threaded thread creation" << endl;
173
174 // Measure how long it takes to start up a bunch of threads
175 StopWatch total_time_parallel_native;
176 total_time_parallel_native.Start();
177
178 TimeParallelExecutors(20, 1);
179 TimeParallelExecutors(20, 5);
180 TimeParallelExecutors(20, 50);
181 TimeParallelExecutors(20, 500);
182
183 total_time_parallel_native.Stop();

Callers

nothing calls this directly

Calls 5

TimeParallelExecutorsFunction · 0.85
InitThreadingFunction · 0.50
StartMethod · 0.45
StopMethod · 0.45
ElapsedTimeMethod · 0.45

Tested by

no test coverage detected