Skip to content

Commit

Permalink
#186 calculate architecture-dependent heap size
Browse files Browse the repository at this point in the history
  • Loading branch information
I-mikan-I committed Mar 4, 2024
1 parent d0101be commit 8bec9db
Showing 1 changed file with 18 additions and 22 deletions.
40 changes: 18 additions & 22 deletions src/tarfind/tarfind.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 8bec9db

Please sign in to comment.