diff --git a/quads.c b/quads.c index 5e0449875..11d8e5e1f 100644 --- a/quads.c +++ b/quads.c @@ -101,24 +101,18 @@ static size_t tree_size(size_t depth) { #define MAX_THREAD_COUNT 256 int main(int argc, char *argv[]) { - if (argc != 4) { - fprintf(stderr, "usage: %s DEPTH MULTIPLIER PARALLELISM\n", argv[0]); + if (argc < 3 || 4 < argc) { + fprintf(stderr, "usage: %s DEPTH MULTIPLIER [GC-OPTIONS]\n", argv[0]); return 1; } size_t depth = parse_size(argv[1], "depth"); double multiplier = atof(argv[2]); - size_t parallelism = atol(argv[3]); if (!(1.0 < multiplier && multiplier < 100)) { fprintf(stderr, "Failed to parse heap multiplier '%s'\n", argv[2]); return 1; } - if (parallelism < 1 || parallelism > MAX_THREAD_COUNT) { - fprintf(stderr, "Expected integer between 1 and %d for parallelism, got '%s'\n", - (int)MAX_THREAD_COUNT, argv[3]); - return 1; - } size_t nquads = tree_size(depth); size_t tree_bytes = nquads * sizeof(Quad); @@ -131,7 +125,12 @@ int main(int argc, char *argv[]) { struct gc_options *options = gc_allocate_options(); gc_options_set_int(options, GC_OPTION_HEAP_SIZE_POLICY, GC_HEAP_SIZE_FIXED); gc_options_set_size(options, GC_OPTION_HEAP_SIZE, heap_size); - gc_options_set_int(options, GC_OPTION_PARALLELISM, parallelism); + if (argc == 4) { + if (!gc_options_parse_and_set_many(options, argv[3])) { + fprintf(stderr, "Failed to set GC options: '%s'\n", argv[3]); + return 1; + } + } struct gc_heap *heap; struct gc_mutator *mut;