7#define GETPID_ITER 100000
20 perror(
"Failed to open /dev/const/zero");
40static void benchmark_getpid(
void)
71#define ERR ((uint64_t)-1)
81 if (ptr == MAP_FAILED)
90 return munmap(addr, length) == -1 ?
ERR : 0;
110 ((
uint8_t*)ptr)[j * 0x1000] = 0;
133 for (
uint64_t i = 50; i <= 1500; i += 50)
EFI_PHYSICAL_ADDRESS buffer
fd_t open(const char *path)
System call for opening files.
size_t readfile(const char *path, void *buffer, size_t count, size_t offset)
Wrapper for reading a file directly using a path.
void * mmap(fd_t fd, void *address, size_t length, prot_t prot)
System call to map memory from a file.
pid_t getpid(void)
System call to retrieve the current pid.
void * munmap(void *address, size_t length)
System call to unmap mapped memory.
@ PROT_READ
Readable memory.
@ PROT_WRITE
Writable memory.
#define NULL
Pointer error value.
#define ERR
Integer error value.
__UINT64_TYPE__ fd_t
File descriptor type.
__UINT64_TYPE__ clock_t
A nanosecond time.
static void init_generic()
static uint64_t munmap_generic(void *addr, size_t length)
static void benchmark_mmap(uint64_t pages)
static void * mmap_generic(size_t length)
_PUBLIC int printf(const char *_RESTRICT format,...)
_PUBLIC void perror(const char *s)
_PUBLIC _NORETURN void abort(void)
_PUBLIC clock_t clock(void)