pub fn format_duration(ns: u64) -> String
Formats a duration in nanoseconds into a human-readable string with appropriate units.