Home | History | Annotate | Download | only in pagingtest
      1 #include <unistd.h>
      2 #include <stdbool.h>
      3 
      4 #ifndef __PAGINGTEST_H__
      5 #define __PAGINGTEST_H__
      6 #define USEC_PER_SEC 1000000ULL
      7 #define mincore_vec_len(size) (((size) + sysconf(_SC_PAGE_SIZE) - 1) / sysconf(_SC_PAGE_SIZE))
      8 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
      9 
     10 //Helpers
     11 int create_tmp_file(char *filename, off_t size);
     12 unsigned char *alloc_mincore_vec(size_t size);
     13 bool check_caching(void *buf, unsigned char *vec, size_t size, bool is_cached);
     14 
     15 //Tests
     16 int mmap_test(int test_runs, unsigned long long alloc_size);
     17 int pageinout_test(int test_runs, bool cache, unsigned long long file_size);
     18 int thrashing_test(int test_runs, bool cache);
     19 
     20 #endif //__PAGINGTEST_H__
     21