Format a token count with K/M suffixes.
(tokens: u64)
| 1221 | |
| 1222 | /// Format a token count with K/M suffixes. |
| 1223 | fn format_tokens(tokens: u64) -> String { |
| 1224 | if tokens >= 1_000_000 { |
| 1225 | format!("{:.1}M", tokens as f64 / 1_000_000.0) |
| 1226 | } else if tokens >= 1_000 { |
| 1227 | format!("{:.1}k", tokens as f64 / 1_000.0) |
| 1228 | } else { |
| 1229 | format!("{}", tokens) |
| 1230 | } |
| 1231 | } |
| 1232 | |
| 1233 | /// Format a duration in milliseconds to a human-readable string. |
| 1234 | fn format_duration_ms(ms: u64) -> String { |
nothing calls this directly
no outgoing calls
no test coverage detected