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

Method UpdatePoolStatsForQueries

be/src/runtime/mem-tracker.cc:421–446  ·  view source on GitHub ↗

Update pool_stats for all queries tracked through query memory trackers:

Source from the content-addressed store, hash-verified

419
420// Update pool_stats for all queries tracked through query memory trackers:
421void MemTracker::UpdatePoolStatsForQueries(int limit, TPoolStats& pool_stats) {
422 if (limit == 0) return;
423 // Init all memory consumption related fields
424 pool_stats.heavy_memory_queries.clear();
425 pool_stats.min_memory_consumed = std::numeric_limits<int64_t>::max();
426 pool_stats.max_memory_consumed = 0;
427 pool_stats.total_memory_consumed = 0;
428 pool_stats.num_running = 0;
429 // Collect the top 'limit' queries into 'min_pq'.
430 MinPriorityQueue min_pq;
431 GetTopNQueriesAndUpdatePoolStats(min_pq, limit, pool_stats);
432 // Grab all remaining entries from the priority queue and assign them in the descending
433 // order of memory consumption to the pool_stats.heavy_memory_queries field in
434 // pool_stats.
435 auto& queries = pool_stats.heavy_memory_queries;
436 queries.clear();
437 while (!min_pq.empty()) {
438 queries.push_back(min_pq.top());
439 min_pq.pop();
440 }
441 std::reverse(queries.begin(), queries.end());
442 // If not a single query is found, set the min_memory_consumed to 0.
443 if (pool_stats.num_running == 0) {
444 pool_stats.min_memory_consumed = 0;
445 }
446}
447
448void MemTracker::GetTopNQueriesAndUpdatePoolStats(
449 MinPriorityQueue& min_pq, int limit, TPoolStats& pool_stats) {

Callers 2

UpdateMemTrackerStatsMethod · 0.80
TESTFunction · 0.80

Calls 7

maxFunction · 0.85
push_backMethod · 0.80
clearMethod · 0.65
emptyMethod · 0.45
topMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.64