MCPcopy Create free account
hub / github.com/apache/datafusion / report_top

Method report_top

datafusion/execution/src/memory_pool/pool.rs:486–517  ·  view source on GitHub ↗

Returns a formatted string with the top memory consumers.

(&self, top: usize)

Source from the content-addressed store, hash-verified

484
485 /// Returns a formatted string with the top memory consumers.
486 pub fn report_top(&self, top: usize) -> String {
487 let mut consumers = self
488 .tracked_consumers
489 .lock()
490 .iter()
491 .map(|(consumer_id, tracked_consumer)| {
492 (
493 (
494 *consumer_id,
495 tracked_consumer.name.to_owned(),
496 tracked_consumer.can_spill,
497 tracked_consumer.peak(),
498 ),
499 tracked_consumer.reserved(),
500 )
501 })
502 .collect::<Vec<_>>();
503 consumers.sort_by_key(|consumer| std::cmp::Reverse(consumer.1));
504
505 consumers[0..std::cmp::min(top, consumers.len())]
506 .iter()
507 .map(|((id, name, can_spill, peak), size)| {
508 format!(
509 " {name}#{id}(can spill: {can_spill}) consumed {}, peak {}",
510 human_readable_size(*size),
511 human_readable_size(*peak),
512 )
513 })
514 .collect::<Vec<_>>()
515 .join(",\n")
516 + "."
517 }
518}
519
520impl<I: MemoryPool> MemoryPool for TrackConsumersPool<I> {

Callers 2

try_growMethod · 0.80

Calls 7

minFunction · 0.85
peakMethod · 0.80
reservedMethod · 0.80
mapMethod · 0.45
iterMethod · 0.45
joinMethod · 0.45
lenMethod · 0.45