fix(bench): warn on all reset_vm_hwm errors, not just PermissionDenied
Issue #38: warn_reset_hwm() silently swallowed non-permission I/O errors from /proc/self/clear_refs (e.g. missing /proc, read-only procfs, kernel incompatibility). This left users unaware that VmHWM reset failed and memory peak data could be contaminated across suites. Changes: - runner.rs: all errors now produce a warning with specific failure reason; PermissionDenied retains 'try running as root' hint; AtomicBool warn-once prevents duplicate output across 7 suite runs - main.rs: preflight check now uses warn_reset_hwm() instead of the vague can_reset_vm_hwm(), sharing the same warn-once mechanism - metrics.rs: remove dead can_reset_vm_hwm() (no callers remaining) - tests: add hwm_warned_flag_prevents_reentry and warn_reset_hwm_does_not_panic
This commit is contained in:
@@ -80,14 +80,6 @@ impl MetricsCollector {
|
||||
})
|
||||
}
|
||||
|
||||
/// Check if we can reset VmHWM (i.e., can open `/proc/self/clear_refs` for writing)
|
||||
pub fn can_reset_vm_hwm() -> bool {
|
||||
std::fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.open("/proc/self/clear_refs")
|
||||
.is_ok()
|
||||
}
|
||||
|
||||
/// Get file inode number
|
||||
pub fn get_inode(path: &Path) -> std::io::Result<u64> {
|
||||
let meta = fs::metadata(path)?;
|
||||
|
||||
Reference in New Issue
Block a user