| 346 | } |
| 347 | |
| 348 | Status RunPerformanceTest(FlightClient* client, const FlightClientOptions& client_options, |
| 349 | const FlightCallOptions& call_options, bool test_put) { |
| 350 | StopWatch timer; |
| 351 | timer.Start(); |
| 352 | |
| 353 | PerformanceStats stats; |
| 354 | for (int i = 0; i < FLAGS_num_perf_runs; ++i) { |
| 355 | RETURN_NOT_OK( |
| 356 | DoSinglePerfRun(client, client_options, call_options, test_put, &stats)); |
| 357 | } |
| 358 | |
| 359 | // Elapsed time in seconds |
| 360 | uint64_t elapsed_nanos = timer.Stop(); |
| 361 | double time_elapsed = |
| 362 | static_cast<double>(elapsed_nanos) / static_cast<double>(1000000000); |
| 363 | |
| 364 | constexpr double kMegabyte = static_cast<double>(1 << 20); |
| 365 | |
| 366 | std::cout << "Number of perf runs: " << FLAGS_num_perf_runs << std::endl; |
| 367 | std::cout << "Number of concurrent gets/puts: " << FLAGS_num_threads << std::endl; |
| 368 | std::cout << "Batch size: " << stats.total_bytes / stats.total_batches << std::endl; |
| 369 | if (FLAGS_test_put) { |
| 370 | std::cout << "Batches written: " << stats.total_batches << std::endl; |
| 371 | std::cout << "Bytes written: " << stats.total_bytes << std::endl; |
| 372 | } else { |
| 373 | std::cout << "Batches read: " << stats.total_batches << std::endl; |
| 374 | std::cout << "Bytes read: " << stats.total_bytes << std::endl; |
| 375 | } |
| 376 | |
| 377 | std::cout << "Nanos: " << elapsed_nanos << std::endl; |
| 378 | std::cout << "Speed: " |
| 379 | << (static_cast<double>(stats.total_bytes) / kMegabyte / time_elapsed) |
| 380 | << " MB/s" << std::endl; |
| 381 | |
| 382 | // Calculate throughput(IOPS) and latency vs batch size |
| 383 | std::cout << "Throughput: " << (static_cast<double>(stats.total_batches) / time_elapsed) |
| 384 | << " batches/s" << std::endl; |
| 385 | std::cout << "Latency mean: " << stats.mean_latency() << " us" << std::endl; |
| 386 | for (auto q : stats.quantiles) { |
| 387 | std::cout << "Latency quantile=" << q << ": " << stats.quantile_latency(q) << " us" |
| 388 | << std::endl; |
| 389 | } |
| 390 | std::cout << "Latency max: " << stats.max_latency() << " us" << std::endl; |
| 391 | |
| 392 | return Status::OK(); |
| 393 | } |
| 394 | |
| 395 | } // namespace flight |
| 396 | } // namespace arrow |
no test coverage detected