Terminal width of stderr via `ioctl(TIOCGWINSZ)`. Falls back to 80 when stderr isn't a TTY (e.g. piped to `tee` or `less`) or the syscall fails.
()
| 2891 | fn kernel_check_clear_every() -> usize { |
| 2892 | env_usize("IX_KERNEL_CHECK_CLEAR_EVERY", DEFAULT_CHECK_CLEAR_EVERY).max(1) |
| 2893 | } |
| 2894 | |
| 2895 | /// Threshold (max cache len) above which a per-block diagnostic line is |
| 2896 | /// emitted, when `IX_KERNEL_CHECK_DIAG=1`. Default 100k entries — empirically |
| 2897 | /// well above the typical mathlib block, so only the heavy outliers print. |
| 2898 | /// Override with `IX_KERNEL_CHECK_DIAG_THRESHOLD=N`. |
| 2899 | fn kernel_check_diag_threshold() -> Option<usize> { |
| 2900 | let enabled = matches!( |
| 2901 | std::env::var("IX_KERNEL_CHECK_DIAG").as_deref(), |
| 2902 | Ok("1" | "true" | "on" | "yes") |
| 2903 | ); |
| 2904 | if !enabled { |
| 2905 | return None; |
| 2906 | } |
| 2907 | Some(env_usize("IX_KERNEL_CHECK_DIAG_THRESHOLD", 100_000)) |
| 2908 | } |
| 2909 | |
| 2910 | fn kernel_check_mem_stats_enabled() -> bool { |
| 2911 | // Default ON: RSS via /proc/self/status + DashMap.len() is one syscall and |
| 2912 | // one atomic load per progress tick (~2s). Negligible overhead, and the |
| 2913 | // suffix is the primary signal for diagnosing memory growth across a long |
| 2914 | // env-check run. Explicit `IX_KERNEL_CHECK_MEM_STATS=0|false|off|no` opts |
| 2915 | // out for callers who want a clean line. |