From 7e185b53c591444cf03437a15cd3bec1570fa5c9 Mon Sep 17 00:00:00 2001 From: Prabhpreet Dua <615318+prabhpreet@users.noreply.github.com> Date: Thu, 30 May 2024 15:59:07 +0530 Subject: [PATCH] Add memfd secret bench --- memsec-test/benches/malloc.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/memsec-test/benches/malloc.rs b/memsec-test/benches/malloc.rs index 812fac9..aff63a0 100644 --- a/memsec-test/benches/malloc.rs +++ b/memsec-test/benches/malloc.rs @@ -14,6 +14,15 @@ fn memsec_malloc(b: &mut Bencher) { }); } +#[cfg(unix)] +#[bench] +fn memsec_memfd_secret(b: &mut Bencher) { + b.iter(|| unsafe { + let ptr: NonNull<[u8; 512]> = memsec::memfd_secret().unwrap(); + memsec::free_memfd_secret(ptr); + }); +} + #[cfg(unix)] #[bench] fn libsodium_malloc(b: &mut Bencher) {