mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-28 05:50:30 +02:00
Rework mtbench to take GC options string instead of parallelism
This commit is contained in:
parent
f15eb3bd10
commit
9576558a34
1 changed files with 8 additions and 9 deletions
17
mt-gcbench.c
17
mt-gcbench.c
|
@ -330,14 +330,13 @@ int main(int argc, char *argv[]) {
|
|||
tree_size(long_lived_tree_depth) * sizeof(Node) +
|
||||
tree_size(max_tree_depth) * sizeof(Node) +
|
||||
sizeof(DoubleArray) + sizeof(double) * array_size;
|
||||
if (argc != 4) {
|
||||
fprintf(stderr, "usage: %s MULTIPLIER NTHREADS PARALLELISM\n", argv[0]);
|
||||
if (argc < 3 || argc > 4) {
|
||||
fprintf(stderr, "usage: %s MULTIPLIER NTHREADS [GC-OPTIONS]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
double multiplier = atof(argv[1]);
|
||||
size_t nthreads = atol(argv[2]);
|
||||
size_t parallelism = atol(argv[3]);
|
||||
|
||||
if (!(0.1 < multiplier && multiplier < 100)) {
|
||||
fprintf(stderr, "Failed to parse heap multiplier '%s'\n", argv[1]);
|
||||
|
@ -348,18 +347,18 @@ int main(int argc, char *argv[]) {
|
|||
(int)MAX_THREAD_COUNT, 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 heap_size = heap_max_live * multiplier * nthreads;
|
||||
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue