From f6eb65f74dff2f53fc4eda5fa7eaad64422e8fff Mon Sep 17 00:00:00 2001 From: Akilan Date: Thu, 28 Aug 2025 11:57:15 +0100 Subject: [PATCH] test whole program --- benchmarks/benchmarks/XSbench/malloc.h | 60 +++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/benchmarks/benchmarks/XSbench/malloc.h b/benchmarks/benchmarks/XSbench/malloc.h index 1e451e9..c67a1e0 100644 --- a/benchmarks/benchmarks/XSbench/malloc.h +++ b/benchmarks/benchmarks/XSbench/malloc.h @@ -64,46 +64,46 @@ int MallocCounter; size_t sizeUsed; -INITAlloc(void) { +// INITAlloc(void) { - size_t sz; - // Pre Allocate 600 MB - sz = 100000000; +// size_t sz; +// // Pre Allocate 600 MB +// sz = 100000000; - int fd = open(FILENAME, O_RDWR, 0600); +// int fd = open(FILENAME, O_RDWR, 0600); - if (fd < 0) { - perror("open"); - exit(EXIT_FAILURE); - } +// if (fd < 0) { +// perror("open"); +// exit(EXIT_FAILURE); +// } - off_t offset = 0; // offset to seek to. +// off_t offset = 0; // offset to seek to. - if (ftruncate(fd, sz) < 0) { - perror("ftruncate"); - close(fd); - exit(EXIT_FAILURE); - } +// if (ftruncate(fd, sz) < 0) { +// perror("ftruncate"); +// close(fd); +// exit(EXIT_FAILURE); +// } - // ptr = mmap(NULL, sz, - // PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON,-1,0); +// // ptr = mmap(NULL, sz, +// // PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON,-1,0); - ptr = mmap(NULL, sz, - PROT_READ|PROT_WRITE, MAP_SHARED,fd,0); +// ptr = mmap(NULL, sz, +// PROT_READ|PROT_WRITE, MAP_SHARED,fd,0); - // Added error handling - if(ptr == MAP_FAILED) - { - perror("mmap"); - exit(EXIT_FAILURE); - } +// // Added error handling +// if(ptr == MAP_FAILED) +// { +// perror("mmap"); +// exit(EXIT_FAILURE); +// } - MallocCounter = (int)sz; +// MallocCounter = (int)sz; -} +// } // Quick malloc implementation with mmap -void* MALLOCCHERI(size_t sz) +static void* MALLOCCHERI(size_t sz) { printf("Malloc called lol"); printf("Malloc called lol"); @@ -125,7 +125,7 @@ void* MALLOCCHERI(size_t sz) } // Quick cheri free implementation -void FREECHERI(void *ptr) { +static void FREECHERI(void *ptr) { // printf("free called \n"); @@ -155,7 +155,7 @@ pagesizes(size_t ps[MAXPAGESIZES]) } __attribute__((constructor)) -INITREGULARALLOC(void) { +static INITREGULARALLOC(void) { size_t sz; // Hard-coded for 1GB huge page sz = 1073741824;