MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / get_memory_executor

Function get_memory_executor

src/executor/tests.rs:388–414  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

386 use crate::executor::memory::executor::MemoryExecutor;
387
388 async fn get_memory_executor() -> (
389 SemaphorePermit<'static>,
390 SemaphorePermit<'static>,
391 MemoryExecutor,
392 ) {
393 static MEMORY_INIT: OnceCell<()> = OnceCell::const_new();
394 static MEMORY_SEMAPHORE: OnceCell<Semaphore> = OnceCell::const_new();
395
396 MEMORY_INIT
397 .get_or_init(|| async {
398 let executor = MemoryExecutor;
399 let system_info = SystemInfo::new().unwrap();
400 executor.setup(&system_info, None).await.unwrap();
401 executor.grant_privileges().unwrap();
402 })
403 .await;
404
405 let semaphore = MEMORY_SEMAPHORE
406 .get_or_init(|| async { Semaphore::new(1) })
407 .await;
408 let permit = semaphore.acquire().await.unwrap();
409
410 // Memory executor uses heaptrack which uses BPF-based instrumentation, which conflicts with valgrind.
411 let _lock = acquire_bpf_instrumentation_lock().await;
412
413 (permit, _lock, MemoryExecutor)
414 }
415
416 fn memory_config(command: &str) -> ExecutorConfig {
417 ExecutorConfig {

Callers 3

test_memory_executorFunction · 0.85

Calls 3

setupMethod · 0.45
grant_privilegesMethod · 0.45

Tested by

no test coverage detected