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

Function print_memory_stats

benchmarks/src/util/memory.rs:19–57  ·  view source on GitHub ↗

Print Peak RSS, Peak Commit, Page Faults based on mimalloc api

()

Source from the content-addressed store, hash-verified

17
18/// Print Peak RSS, Peak Commit, Page Faults based on mimalloc api
19pub fn print_memory_stats() {
20 #[cfg(all(feature = "mimalloc", feature = "mimalloc_extended"))]
21 {
22 use datafusion_common::human_readable_size;
23 let mut peak_rss = 0;
24 let mut peak_commit = 0;
25 let mut page_faults = 0;
26 unsafe {
27 libmimalloc_sys::mi_process_info(
28 std::ptr::null_mut(),
29 std::ptr::null_mut(),
30 std::ptr::null_mut(),
31 std::ptr::null_mut(),
32 &mut peak_rss,
33 std::ptr::null_mut(),
34 &mut peak_commit,
35 &mut page_faults,
36 );
37 }
38
39 // When modifying this output format, make sure to update the corresponding
40 // parsers in `mem_profile.rs`, specifically `parse_vm_line` and `parse_query_time`,
41 // to keep the log output and parser logic in sync.
42 println!(
43 "Peak RSS: {}, Peak Commit: {}, Page Faults: {}",
44 if peak_rss == 0 {
45 "N/A".to_string()
46 } else {
47 human_readable_size(peak_rss)
48 },
49 if peak_commit == 0 {
50 "N/A".to_string()
51 } else {
52 human_readable_size(peak_commit)
53 },
54 page_faults
55 );
56 }
57}

Callers 8

sqlFunction · 0.85
benchmark_queryMethod · 0.85
benchmark_queryMethod · 0.85
runMethod · 0.85
benchmark_queryMethod · 0.85
benchmark_queryMethod · 0.85
benchmark_queryMethod · 0.85
benchmark_queryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…