From: Simon Gerber Date: Mon, 3 Aug 2015 13:42:20 +0000 (+0200) Subject: large page morecore: add command line options to test X-Git-Tag: release2015-09-03~57 X-Git-Url: http://git.barrelfish.org/?p=barrelfish;a=commitdiff_plain;h=379a4fed0f957e62c143178a12de8947c4b5ee21 large page morecore: add command line options to test Signed-off-by: Simon Gerber --- diff --git a/usr/tests/large_page/malloc_test.c b/usr/tests/large_page/malloc_test.c index 1f5f954..f2d7e7d 100644 --- a/usr/tests/large_page/malloc_test.c +++ b/usr/tests/large_page/malloc_test.c @@ -15,12 +15,28 @@ #include #include -#define RUNS 2 +#define DEFAULT_RUNS 2 // 128MB buffer -#define BUFSIZE (128UL*1024*1024) +#define DEFAULT_BUFSIZE (128UL*1024*1024) -int main(void) +int main(int argc, char *argv[]) { + unsigned long BUFSIZE = DEFAULT_BUFSIZE; + unsigned RUNS = DEFAULT_RUNS; + if (argc == 2) { + if (strcmp(argv[1], "-h") == 0) { + debug_printf("usage: %s \n", argv[0]); + debug_printf(" both arguments are optional, defaults are:\n"); + debug_printf(" BUFSIZE = %lu\n", DEFAULT_BUFSIZE); + debug_printf(" RUNS = %u\n", DEFAULT_RUNS); + return 0; + } + BUFSIZE = strtol(argv[1], NULL, 0); + } + if (argc == 3) { + RUNS = strtol(argv[1], NULL, 0); + } + debug_printf("running malloc test with BUFSIZE = %lu, runs = %u\n", BUFSIZE, RUNS); void *bufs[RUNS]; for (int k = 0; k < RUNS; k++) { // touch every 4k page in region