MCPcopy Create free account
hub / github.com/apache/impala / ComputeQuerySummary

Method ComputeQuerySummary

be/src/runtime/coordinator.cc:1392–1495  ·  view source on GitHub ↗

TODO: add histogram/percentile

Source from the content-addressed store, hash-verified

1390
1391// TODO: add histogram/percentile
1392void Coordinator::ComputeQuerySummary() {
1393 DCHECK(exec_rpcs_complete_.Load()) << "Exec() must be called first";
1394 // In this case, the query did not even get to start all fragment instances.
1395 // Some of the state that is used below might be uninitialized. In this case,
1396 // the query has made so little progress, reporting a summary is not very useful.
1397 if (!has_called_wait_.Load()) return;
1398
1399 if (backend_states_.empty()) return;
1400 // make sure fragment_stats_ are up-to-date
1401 for (BackendState* backend_state: backend_states_) {
1402 backend_state->UpdateExecStats(fragment_stats_, /*finalize=*/true);
1403 }
1404
1405 for (FragmentStats* fragment_stats: fragment_stats_) {
1406 fragment_stats->AddSplitStats();
1407 // TODO: output the split info string and detailed stats to VLOG_FILE again?
1408 fragment_stats->AddExecStats();
1409 }
1410
1411 stringstream mem_info, cpu_user_info, cpu_system_info, bytes_read_info;
1412 ResourceUtilization total_utilization;
1413 BackendMachineInfoAggregator machine_info_aggregator;
1414
1415 for (BackendState* backend_state: backend_states_) {
1416 ResourceUtilization utilization = backend_state->GetResourceUtilization();
1417 total_utilization.Merge(utilization);
1418 string network_address = NetworkAddressPBToString(backend_state->impalad_address());
1419 mem_info << network_address << "("
1420 << PrettyPrinter::Print(utilization.peak_per_host_mem_consumption,
1421 TUnit::BYTES) << ") ";
1422 bytes_read_info << network_address << "("
1423 << PrettyPrinter::Print(utilization.bytes_read, TUnit::BYTES) << ") ";
1424 cpu_user_info << network_address << "("
1425 << PrettyPrinter::Print(utilization.cpu_user_ns, TUnit::TIME_NS)
1426 << ") ";
1427 cpu_system_info << network_address << "("
1428 << PrettyPrinter::Print(utilization.cpu_sys_ns, TUnit::TIME_NS)
1429 << ") ";
1430
1431 // Aggregate machine information.
1432 DCHECK(backend_state->exec_params().has_machine_info());
1433 machine_info_aggregator.Merge(backend_state->exec_params().machine_info());
1434 }
1435
1436 // The definitions of these counters are in the top of this file.
1437 COUNTER_SET(PROFILE_TotalBytesRead.Instantiate(query_profile_),
1438 total_utilization.bytes_read);
1439 COUNTER_SET(PROFILE_TotalCpuTime.Instantiate(query_profile_),
1440 total_utilization.cpu_user_ns + total_utilization.cpu_sys_ns);
1441 COUNTER_SET(PROFILE_TotalBytesSent.Instantiate(query_profile_),
1442 total_utilization.scan_bytes_sent + total_utilization.exchange_bytes_sent);
1443 COUNTER_SET(PROFILE_TotalScanBytesSent.Instantiate(query_profile_),
1444 total_utilization.scan_bytes_sent);
1445 COUNTER_SET(PROFILE_TotalInnerBytesSent.Instantiate(query_profile_),
1446 total_utilization.exchange_bytes_sent);
1447
1448 double xchg_scan_ratio = 0;
1449 if (total_utilization.bytes_read > 0) {

Callers

nothing calls this directly

Calls 15

NetworkAddressPBToStringFunction · 0.85
UpdateExecStatsMethod · 0.80
AddSplitStatsMethod · 0.80
AddExecStatsMethod · 0.80
AddSkewInfoMethod · 0.80
AddInfoStringMethod · 0.80
HasDataMethod · 0.80
GetCpuSummaryMethod · 0.80
GetOsSummaryMethod · 0.80
num_filtersMethod · 0.80
LoadMethod · 0.45

Tested by

no test coverage detected