| 314 | } |
| 315 | |
| 316 | int main(int argc, char** argv) { |
| 317 | impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST); |
| 318 | impala::InitFeSupport(); |
| 319 | /// Runtime Benchmark |
| 320 | std::cout << Benchmark::GetMachineInfo() << std::endl; |
| 321 | std::cout << "Note: Benchmark name are in format <name>_XX_YY:" << std::endl |
| 322 | << "name represents the name of benchmark (probe|build|memory)." << std::endl |
| 323 | << "XX represents the number of rows in the dataset." << std::endl |
| 324 | << "YY represents the percentage of unique values in dataset." << std::endl; |
| 325 | std::cout << "Runtime Benchmark" << std::endl; |
| 326 | std::cout << "-----------------" << std::endl; |
| 327 | |
| 328 | Benchmark hash_table_build("Hash Table Build", false); |
| 329 | Benchmark hash_table_probe("Hash Table Probe", false); |
| 330 | vector<int> num_tuples{65536, 262144}; |
| 331 | vector<int> unique_percent{100, 60, 20}; |
| 332 | vector<TestCtx*> ctxs; |
| 333 | for (int num = 0; num < num_tuples.size(); num++) { |
| 334 | for (int up = 0; up < unique_percent.size(); up++) { |
| 335 | std::stringstream pname; |
| 336 | std::stringstream bname; |
| 337 | pname << "probe_" << num_tuples[num] << "_" << unique_percent[up]; |
| 338 | bname << "build_" << num_tuples[num] << "_" << unique_percent[up]; |
| 339 | TestCtx* ctx = new TestCtx(); |
| 340 | ctx->SetUp(num_tuples[num]); |
| 341 | ctxs.push_back(ctx); |
| 342 | ctx->CreateDataSet(num_tuples[num], unique_percent[up]); |
| 343 | hash_table_build.AddBenchmark(bname.str(), build::Benchmark, (void*)ctx, -1); |
| 344 | hash_table_probe.AddBenchmark(pname.str(), probe::Benchmark, (void*)ctx, -1); |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | // Create Probe benchmark for Data not found in the table |
| 349 | for (int num = 0; num < num_tuples.size(); num++) { |
| 350 | TestCtx* ctx = new TestCtx(); |
| 351 | ctx->SetUp(num_tuples[num]); |
| 352 | ctxs.push_back(ctx); |
| 353 | ctx->CreateDataSet(num_tuples[num], 10); |
| 354 | Build(ctx, ctx->data); |
| 355 | ctx->CreateAbsentKeysData(num_tuples[num]); |
| 356 | std::stringstream pname; |
| 357 | pname << "probe_" << num_tuples[num] << "_absentkeys"; |
| 358 | hash_table_probe.AddBenchmark(pname.str(), probe::Benchmark, (void*)ctx, -1); |
| 359 | } |
| 360 | std::cout << hash_table_build.Measure(50, 10, build::SetUp) << std::endl; |
| 361 | std::cout << hash_table_probe.Measure() << std::endl; |
| 362 | // Cleanup contexts |
| 363 | for (TestCtx* ct : ctxs) { |
| 364 | ct->TearDown(); |
| 365 | free(ct); |
| 366 | } |
| 367 | |
| 368 | /// Memory Benchmark |
| 369 | std::cout << "Memory Benchmark" << std::endl; |
| 370 | std::cout << "----------------" << std::endl; |
| 371 | vector<std::string> benchmark_names; |
| 372 | vector<int64_t> memory_consumption; |
| 373 | num_tuples.clear(); |
nothing calls this directly
no test coverage detected