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

Method AppendStatsForConsumedMemory

be/src/scheduling/admission-controller.cc:454–485  ·  view source on GitHub ↗

Append to ss a debug string for memory consumption part of the pool stats. Here is one example. topN_query_stats: queries=[554b016cf0f3a37f:9a1bfcfd00000000, 464dcd9cc47d724b:9e6a3f6400000000, 2844275a1458bf1f:0bc5887500000000, a449dbc7bcbd2af1:647e6ded00000000, 8c430ea5ad38e94a:3c27bf4400000000], total_mem_consumed=1.26 MB, fraction_of_pool_total_mem=0.61; pool_level_stats: num_running=10, min=0,

Source from the content-addressed store, hash-verified

452// num_running=10, min=0, max=257.48 KB, pool_total_mem=2.06 MB, average_per_query=210.74
453// KB
454void AdmissionController::PoolStats::AppendStatsForConsumedMemory(
455 stringstream& ss, const TPoolStats& stats) {
456 ss << "topN_query_stats: ";
457 ss << "queries=[";
458 int num_ids = stats.heavy_memory_queries.size();
459 int64_t total_memory_consumed_by_top_queries = 0;
460 for (int i = 0; i < num_ids; i++) {
461 auto& query = stats.heavy_memory_queries[i];
462 total_memory_consumed_by_top_queries += query.memory_consumed;
463 ss << PrintId(query.queryId);
464 if (i < num_ids - 1) ss << ", ";
465 }
466 ss << "], ";
467 ss << "total_mem_consumed="
468 << PrettyPrinter::PrintBytes(total_memory_consumed_by_top_queries);
469 int64_t total_memory_consumed = stats.total_memory_consumed;
470 if (total_memory_consumed > 0) {
471 ss << ", fraction_of_pool_total_mem=" << setprecision(2)
472 << float(total_memory_consumed_by_top_queries) / total_memory_consumed;
473 }
474 ss << "; ";
475
476 ss << "pool_level_stats: ";
477 ss << "num_running=" << stats.num_running << ", ";
478 ss << "min=" << PrettyPrinter::PrintBytes(stats.min_memory_consumed) << ", ";
479 ss << "max=" << PrettyPrinter::PrintBytes(stats.max_memory_consumed) << ", ";
480 ss << "pool_total_mem=" << PrettyPrinter::PrintBytes(total_memory_consumed);
481 if (stats.num_running > 0) {
482 ss << ", average_per_query="
483 << PrettyPrinter::PrintBytes(total_memory_consumed / stats.num_running);
484 }
485}
486
487// Return a debug string for the pool stats.
488string AdmissionController::PoolStats::DebugPoolStats(const TPoolStats& stats) const {

Callers

nothing calls this directly

Calls 3

PrintIdFunction · 0.85
PrintBytesFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected