MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / runBenchmarkWithGenerator

Method runBenchmarkWithGenerator

programs/keeper-bench/Runner.cpp:1214–1318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1212}
1213
1214void Runner::runBenchmarkWithGenerator()
1215{
1216 pool.emplace(CurrentMetrics::LocalThread, CurrentMetrics::LocalThreadActive, CurrentMetrics::LocalThreadScheduled, concurrency);
1217 createConnections();
1218
1219 std::cerr << "Preparing to run\n";
1220 benchmark_context.startup(*connections[0]);
1221 std::cerr << "Prepared\n";
1222
1223 warmup_complete = warmup_seconds <= 0;
1224
1225 int64_t start_timestamp_ms = 0;
1226 threads = std::vector<ThreadState>(concurrency);
1227
1228 /// All threads must finish generator initialization (which resolves
1229 /// `children_of` paths) before any thread starts executing requests.
1230 generator_init_barrier = std::make_unique<std::barrier<>>(concurrency);
1231
1232 try
1233 {
1234 for (size_t i = 0; i < concurrency; ++i)
1235 {
1236 threads[i].thread_idx = i;
1237 auto thread_connections = connections;
1238 pool->scheduleOrThrowOnError([this, i, my_connections = std::move(thread_connections)]() mutable { thread(my_connections, threads.at(i)); });
1239 }
1240 }
1241 catch (...)
1242 {
1243 shutdown = true;
1244 pool->wait();
1245 throw;
1246 }
1247
1248 DB::InterruptListener interrupt_listener;
1249 /// Reset regardless of warmup so setup time is excluded from throughput and time limit
1250 info->elapsed.restart();
1251 total_watch.restart();
1252 start_timestamp_ms = Poco::Timestamp().epochMicroseconds() / 1000;
1253 Stopwatch warmup_watch;
1254 delay_watch.restart();
1255
1256 /// Accumulates stats across all periods for the final report.
1257 auto cumulative_info = std::make_shared<Stats>();
1258 cumulative_info->elapsed.restart();
1259
1260 while (!shutdown)
1261 {
1262 if (max_time > 0 && total_watch.elapsedSeconds() >= max_time)
1263 {
1264 std::cerr << "Stopping launch of queries. Requested time limit is exhausted.\n";
1265 shutdown = true;
1266 break;
1267 }
1268
1269 if (interrupt_listener.check())
1270 {
1271 std::cerr << "Stopping launch of queries. SIGINT received." << std::endl;

Callers

nothing calls this directly

Calls 15

TimestampClass · 0.85
sleep_forFunction · 0.85
epochMicrosecondsMethod · 0.80
emplaceMethod · 0.45
startupMethod · 0.45
atMethod · 0.45
waitMethod · 0.45
restartMethod · 0.45
elapsedSecondsMethod · 0.45
checkMethod · 0.45
mergeMethod · 0.45

Tested by

no test coverage detected