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

Function main

cpp/src/arrow/flight/flight_benchmark.cc:398–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396} // namespace arrow
397
398int main(int argc, char** argv) {
399 gflags::ParseCommandLineFlags(&argc, &argv, true);
400
401 std::cout << "Testing method: ";
402 if (FLAGS_test_put) {
403 std::cout << "DoPut";
404 } else {
405 std::cout << "DoGet";
406 }
407 std::cout << std::endl;
408
409 arrow::flight::FlightCallOptions call_options;
410 if (!FLAGS_compression.empty()) {
411 if (!FLAGS_test_put) {
412 std::cerr << "Compression is only useful for Put test now, "
413 "please append \"-test_put\" to command line"
414 << std::endl;
415 std::abort();
416 }
417
418 // "zstd" -> name = "zstd", level = default
419 // "zstd:7" -> name = "zstd", level = 7
420 const size_t delim = FLAGS_compression.find(":");
421 const std::string name = FLAGS_compression.substr(0, delim);
422 const std::string level_str =
423 delim == std::string::npos
424 ? ""
425 : FLAGS_compression.substr(delim + 1, FLAGS_compression.length() - delim - 1);
426 const int level = level_str.empty() ? arrow::util::kUseDefaultCompressionLevel
427 : std::stoi(level_str);
428 const auto type = arrow::util::Codec::GetCompressionType(name).ValueOrDie();
429 auto codec = arrow::util::Codec::Create(type, level).ValueOrDie();
430 std::cout << "Compression method: " << name;
431 if (!level_str.empty()) {
432 std::cout << ", level " << level;
433 }
434 std::cout << std::endl;
435
436 call_options.write_options.codec = std::move(codec);
437 }
438 if (!FLAGS_data_file.empty() && !FLAGS_test_put) {
439 std::cerr << "A data file can only be specified with \"-test_put\"" << std::endl;
440 return 1;
441 }
442
443 std::unique_ptr<arrow::flight::TestServer> server;
444 std::vector<std::string> server_args;
445 server_args.push_back("-transport");
446 server_args.push_back(FLAGS_transport);
447 arrow::flight::Location location;
448 auto options = arrow::flight::FlightClientOptions::Defaults();
449 if (FLAGS_transport == "grpc") {
450 if (FLAGS_test_unix || !FLAGS_server_unix.empty()) {
451 if (FLAGS_server_unix == "") {
452 FLAGS_server_unix = "/tmp/flight-bench-spawn.sock";
453 std::cout << "Using spawned Unix server" << std::endl;
454 server.reset(
455 new arrow::flight::TestServer("arrow-flight-perf-server", FLAGS_server_unix));

Callers

nothing calls this directly

Calls 15

WaitForReadyFunction · 0.85
RunPerformanceTestFunction · 0.85
substrMethod · 0.80
ValueOrDieMethod · 0.80
push_backMethod · 0.80
DefaultsFunction · 0.50
emptyMethod · 0.45
findMethod · 0.45
lengthMethod · 0.45
resetMethod · 0.45
ValueMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected