pub fn with_profiler(f: impl FnOnce(&Profiler, &mut PerThreadData))