Render a one-shot human-readable summary. Cheap to call (a single load of each counter) and safe to call concurrently with recording. When [`enabled`] is false the summary is empty so callers can dump unconditionally.
(&self)
| 222 | /// When [`enabled`] is false the summary is empty so callers can dump |
| 223 | /// unconditionally. |
| 224 | pub fn summary(&self) -> String { |
| 225 | if !enabled() { |
| 226 | return String::new(); |
| 227 | } |
| 228 | let mut s = String::with_capacity(1024); |
| 229 | let _ = self.write_summary(&mut s); |
| 230 | s |
| 231 | } |
| 232 | |
| 233 | fn write_summary(&self, out: &mut impl fmt::Write) -> fmt::Result { |
| 234 | writeln!(out, "[ix-perf] cache hit rates:")?; |
no test coverage detected