()
| 211 | use crate::executor::wall_time::executor::WallTimeExecutor; |
| 212 | |
| 213 | async fn get_walltime_executor() -> (SemaphorePermit<'static>, WallTimeExecutor) { |
| 214 | static WALLTIME_INIT: OnceCell<()> = OnceCell::const_new(); |
| 215 | static WALLTIME_SEMAPHORE: OnceCell<Semaphore> = OnceCell::const_new(); |
| 216 | |
| 217 | WALLTIME_INIT |
| 218 | .get_or_init(|| async { |
| 219 | let executor = WallTimeExecutor::new(None); |
| 220 | let system_info = SystemInfo::new().unwrap(); |
| 221 | executor.setup(&system_info, None).await.unwrap(); |
| 222 | }) |
| 223 | .await; |
| 224 | |
| 225 | // We can't execute multiple walltime executors in parallel because perf isn't thread-safe (yet). We have to |
| 226 | // use a semaphore to limit concurrent access. |
| 227 | let semaphore = WALLTIME_SEMAPHORE |
| 228 | .get_or_init(|| async { Semaphore::new(1) }) |
| 229 | .await; |
| 230 | let permit = semaphore.acquire().await.unwrap(); |
| 231 | |
| 232 | (permit, WallTimeExecutor::new(None)) |
| 233 | } |
| 234 | |
| 235 | fn walltime_config(command: &str, enable_profiler: bool) -> ExecutorConfig { |
| 236 | ExecutorConfig { |
no test coverage detected