PatchworkOS
Loading...
Searching...
No Matches
main.c File Reference
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>

Go to the source code of this file.

Macros

#define TEST_ITERATIONS   10000
 
#define ERR   ((uint64_t)-1)
 

Functions

static void init_generic ()
 
static void * mmap_generic (size_t length)
 
static uint64_t munmap_generic (void *addr, size_t length)
 
static void benchmark_mmap (uint64_t pages)
 
int main ()
 

Macro Definition Documentation

◆ ERR

#define ERR   ((uint64_t)-1)

Definition at line 44 of file main.c.

◆ TEST_ITERATIONS

#define TEST_ITERATIONS   10000

Definition at line 6 of file main.c.

Function Documentation

◆ benchmark_mmap()

static void benchmark_mmap ( uint64_t  pages)
static

Definition at line 68 of file main.c.

References clock(), CLOCKS_PER_SEC, mmap_generic(), munmap_generic(), NULL, perror(), printf(), start(), and TEST_ITERATIONS.

Referenced by main().

◆ init_generic()

static void init_generic ( )
static

Definition at line 46 of file main.c.

Referenced by main().

◆ main()

int main ( void  )

Definition at line 97 of file main.c.

References benchmark_mmap(), init_generic(), printf(), and TEST_ITERATIONS.

◆ mmap_generic()

static void * mmap_generic ( size_t  length)
static

Definition at line 51 of file main.c.

References mmap(), NULL, PROT_READ, and PROT_WRITE.

Referenced by benchmark_mmap().

◆ munmap_generic()

static uint64_t munmap_generic ( void *  addr,
size_t  length 
)
static

Definition at line 61 of file main.c.

References ERR, and munmap().

Referenced by benchmark_mmap().