| 2735 | threshold: usize, |
| 2736 | worker_peak_cache: &mut usize, |
| 2737 | progress: &ParallelProgress, |
| 2738 | ) { |
| 2739 | let sizes = kenv.cache_sizes(); |
| 2740 | let max_cache = sizes.max(); |
| 2741 | let is_new_peak = max_cache > *worker_peak_cache; |
| 2742 | let exceeds_threshold = max_cache >= threshold; |
| 2743 | if !is_new_peak && !exceeds_threshold { |
| 2744 | return; |
| 2745 | } |
| 2746 | if is_new_peak { |
| 2747 | *worker_peak_cache = max_cache; |
| 2748 | } |
| 2749 | let elapsed = outcome |
| 2750 | .elapsed |
| 2751 | .map_or_else(|| "?".to_string(), |d| format!("{:.1}s", d.as_secs_f64())); |
| 2752 | let tag = if is_new_peak { "[diag-peak]" } else { "[diag-big]" }; |
| 2753 | progress.log(&format!( |
| 2754 | "{tag} w={worker_idx} block={}/{} ({}) elapsed={elapsed} max={max_cache} {sizes}", |
| 2755 | work_idx + 1, |
| 2756 | work_total, |
| 2757 | outcome.display, |
| 2758 | )); |
| 2759 | } |
| 2760 | |
| 2761 | fn current_rss_mib() -> Option<u64> { |
| 2762 | let status = std::fs::read_to_string("/proc/self/status").ok()?; |
| 2763 | for line in status.lines() { |
| 2764 | let Some(rest) = line.strip_prefix("VmRSS:") else { |
| 2765 | continue; |