MCPcopy Create free account
hub / github.com/ByConity/ByConity / runBenchmark

Method runBenchmark

programs/benchmark/Benchmark.cpp:356–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354 }
355
356 void runBenchmark()
357 {
358 pcg64 generator(randomSeed());
359 std::uniform_int_distribution<size_t> distribution(0, queries.size() - 1);
360
361 try
362 {
363 for (size_t i = 0; i < concurrency; ++i)
364 {
365 EntryPtrs connection_entries;
366 connection_entries.reserve(connections.size());
367
368 for (const auto & connection : connections)
369 connection_entries.emplace_back(std::make_shared<Entry>(
370 connection->get(ConnectionTimeouts::getTCPTimeoutsWithoutFailover(settings))));
371
372 pool.scheduleOrThrowOnError([this, connection_entries]() mutable { thread(connection_entries); });
373 }
374 }
375 catch (...)
376 {
377 pool.wait();
378 throw;
379 }
380
381 InterruptListener interrupt_listener;
382 delay_watch.restart();
383
384 /// Push queries into queue
385 for (size_t i = 0; !max_iterations || i < max_iterations; ++i)
386 {
387 size_t query_index = randomize ? distribution(generator) : i % queries.size();
388
389 if (!tryPushQueryInteractively(queries[query_index], interrupt_listener))
390 {
391 shutdown = true;
392 break;
393 }
394 }
395
396 pool.wait();
397 total_watch.stop();
398
399 if (!json_path.empty())
400 reportJSON(comparison_info_total, json_path);
401
402 printNumberOfQueriesExecuted(queries_executed);
403 report(comparison_info_total);
404 }
405
406
407 void thread(EntryPtrs & connection_entries)

Callers

nothing calls this directly

Calls 12

randomSeedFunction · 0.85
threadFunction · 0.50
reportFunction · 0.50
sizeMethod · 0.45
reserveMethod · 0.45
emplace_backMethod · 0.45
getMethod · 0.45
waitMethod · 0.45
restartMethod · 0.45
stopMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected