From 8bec9dbad1ea51d5f322fe4d819b1c5d232d554f Mon Sep 17 00:00:00 2001 From: I-mikan-I <67881102+I-mikan-I@users.noreply.github.com> Date: Mon, 4 Mar 2024 16:05:15 +0100 Subject: [PATCH] #186 calculate architecture-dependent heap size --- src/tarfind/tarfind.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/tarfind/tarfind.c b/src/tarfind/tarfind.c index b9544f20..dd24833c 100644 --- a/src/tarfind/tarfind.c +++ b/src/tarfind/tarfind.c @@ -22,15 +22,22 @@ /* BEEBS heap is just an array */ /* 8995 = sizeof(tar_header_t) * ARCHIVE_FILES */ #define roundup(d, u) ((((d)+(u))/(u))*(u)) -#define HEAP_SIZE roundup(8995, sizeof(void *)) -static char heap[HEAP_SIZE]; - -void -initialise_benchmark (void) -{ -} +// this is the basic TAR header format which is in ASCII +typedef struct { + char filename[100]; + char mode[8]; // file mode + char uID[8]; // user id + char gID[8]; // group id + char size[12]; // in bytes octal base + char mtime[12]; // numeric Unix time format (octal) + char checksum[8]; // for the header, ignored herew2 + char isLink; + char linkedFile[100]; +} tar_header_t; +#define HEAP_SIZE roundup((sizeof(tar_header_t) * ARCHIVE_FILES), sizeof(void *)) +static char _Alignas(_Alignof(tar_header_t)) heap[HEAP_SIZE]; static int benchmark_body (int rpt); void @@ -40,26 +47,15 @@ warm_caches (int heat) return; } - int benchmark (void) { return benchmark_body (LOCAL_SCALE_FACTOR * CPU_MHZ); } - -// this is the basic TAR header format which is in ASCII -typedef struct { - char filename[100]; - char mode[8]; // file mode - char uID[8]; // user id - char gID[8]; // group id - char size[12]; // in bytes octal base - char mtime[12]; // numeric Unix time format (octal) - char checksum[8]; // for the header, ignored herew2 - char isLink; - char linkedFile[100]; -} tar_header_t; - +void +initialise_benchmark (void) +{ +} static int __attribute__ ((noinline)) benchmark_body (int rpt)