test whole program

This commit is contained in:
2025-08-28 11:11:11 +01:00
parent 6eee6b5a7f
commit 153b625331

View File

@@ -51,84 +51,6 @@
#define MAXPAGESIZES 2
//#define TIMING
/* Debug printf */
#define dprintf(...) fprintf(stdout, __VA_ARGS__)
/* Wrapper to check for errors */
#define CHECK_ERROR(a) \
if (a) \
{ \
perror("Error at line\n\t" #a "\nSystem Msg"); \
assert ((a) == 0); \
}
static inline void *MALLOC(size_t size)
{
void * temp = malloc(size);
assert(temp);
return temp;
}
static inline void *CALLOC(size_t num, size_t size)
{
void * temp = calloc(num, size);
assert(temp);
return temp;
}
static inline void *REALLOC(void *ptr, size_t size)
{
void * temp = realloc(ptr, size);
assert(temp);
return temp;
}
static inline char *GETENV(char *envstr)
{
char *env = getenv(envstr);
if (!env) return "0";
else return env;
}
#define GET_TIME(start, end, duration) \
duration.tv_sec = (end.tv_sec - start.tv_sec); \
if (end.tv_nsec >= start.tv_nsec) { \
duration.tv_nsec = (end.tv_nsec - start.tv_nsec); \
} \
else { \
duration.tv_nsec = (1000000000L - (start.tv_nsec - end.tv_nsec)); \
duration.tv_sec--; \
} \
if (duration.tv_nsec >= 1000000000L) { \
duration.tv_sec++; \
duration.tv_nsec -= 1000000000L; \
}
static inline unsigned int time_diff (
struct timeval *end, struct timeval *begin)
{
#ifdef TIMING
uint64_t result;
result = end->tv_sec - begin->tv_sec;
result *= 1000000; /* usec */
result += end->tv_usec - begin->tv_usec;
return result;
#else
return 0;
#endif
}
static inline void get_time (struct timeval *t)
{
#ifdef TIMING
gettimeofday (t, NULL);
#endif
}
// Expirement work
#define FILENAME "/dev/contigmem"