1 use rustc_data_structures::sync::Lock;
4 use std::time::{Duration, Instant};
9 pub fn to_readable_str(mut val: usize) -> String {
10 let mut groups = vec![];
12 let group = val % 1000;
17 groups.push(group.to_string());
20 groups.push(format!("{:03}", group));
29 pub fn record_time<T, F>(accu: &Lock<Duration>, f: F) -> T
33 let start = Instant::now();
35 let duration = start.elapsed();
36 let mut accu = accu.lock();
41 pub fn indent<R, F>(op: F) -> R
46 // Use in conjunction with the log post-processor like `src/etc/indenter`
47 // to make debug output more readable.
50 debug!("<< (Result = {:?})", r);
55 _cannot_construct_outside_of_this_module: (),
58 impl Drop for Indenter {
64 pub fn indenter() -> Indenter {
66 Indenter { _cannot_construct_outside_of_this_module: () }