void profile_pooled_list_map(struct time_measurements *tm, const unsigned long length, double deletion) { srandom(0xdeadbeef); struct timeval start; struct timeval stop; int64_t del_threshold = RAND_MAX*deletion; pool_reference result_pool = pool_create(LONG_TYPE_ID); gettimeofday(&start, NULL); pool_reference list_pool = pool_create(LIST_TYPE_ID); global_reference head = pool_alloc(&list_pool); pool_iterator itr = iterator_new(&list_pool, &head); for (size_t i = 1 ; i < length; ++i) { iterator_list_insert(itr, pool_alloc(&list_pool)); itr = iterator_next(list_pool, itr); iterator_set_field(itr, 1, &i); } gettimeofday(&stop, NULL); tm->create = SS_TO_USEC(start, stop); flush_cash(); gettimeofday(&start, NULL); itr = iterator_new(&list_pool, &head); while (itr != ITERATOR_END) { if (random() < del_threshold) { if (0 != iterator_list_remove(itr)) break; } else { itr = iterator_next(list_pool, itr); } } gettimeofday(&stop, NULL); tm->del= SS_TO_USEC(start, stop) - deletion_overhead_time(length); flush_cash(); gettimeofday(&start, NULL); field_list_map(head, &result_pool, 1, square); gettimeofday(&stop, NULL); tm->map = SS_TO_USEC(start, stop); flush_cash(); gettimeofday(&start, NULL); push_root(&head); collect_pool(&list_pool); gettimeofday(&stop, NULL); tm->gc = SS_TO_USEC(start, stop); gettimeofday(&start, NULL); field_map(list_pool, &result_pool, 1, square); gettimeofday(&stop, NULL); tm->map_after_gc = SS_TO_USEC(start, stop); pool_destroy(&list_pool); pool_destroy(&result_pool); return; }
static void visit_mark_stack() { while (mark_sp > 0) { push_root(mark_stack[--mark_sp], 0); } }