Skip to content

Commit eca40e9

Browse files
committed
print augment count
1 parent d112deb commit eca40e9

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

tests/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ foreach ts : test_sources
88
t_fbsd = executable('freebsd-' + ts, ts + '.c', include_directories : freebsd)
99
t_fbsd_aug = executable('freebsd-augment-' + ts, ts + '.c', c_args : ['-DDOAUGMENT'], include_directories : freebsd)
1010
t_obsd = executable('openbsd-' + ts, ts + '.c', include_directories : openbsd)
11+
t_obsd_aug = executable('openbsd-augment-' + ts, ts + '.c', c_args : ['-DDOAUGMENT'], include_directories : openbsd)
1112
test('native-3ptr-' + ts, t_3ptr)
1213
test('native-3ptr-augment-' + ts, t_3ptr_aug)
1314
benchmark('freebsd-' + ts, t_fbsd)
1415
benchmark('freebsd-augment-' + ts, t_fbsd_aug)
1516
benchmark('openbsd-' + ts, t_obsd)
17+
benchmark('openbsd-augment-' + ts, t_obsd_aug)
1618
benchmark('native-3ptr-' + ts, t_3ptr)
1719
benchmark('native-3ptr-augment-' + ts, t_3ptr_aug)
1820
endforeach

tests/test_regress.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ struct timespec start, end, diff, rstart, rend, rdiff, rtot = {0, 0};
4949
#define SEED_RANDOM srandom
5050
#endif
5151

52-
int ITER=150000;
52+
int ITER=15000000;
5353
int RANK_TEST_ITERATIONS=10000;
54+
int augment_count = 0;
5455

5556
#define MAX(a, b) ((a) > (b) ? (a) : (b))
5657

@@ -152,10 +153,12 @@ main()
152153
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &end);
153154
timespecsub(&end, &start, &diff);
154155
TDEBUGF("done random insertions in: %llu.%09llu s", (unsigned long long)diff.tv_sec, (unsigned long long)diff.tv_nsec);
156+
TDEBUGF("total augment count: %d", augment_count);
157+
augment_count = 0;
155158

156159
#ifdef DOAUGMENT
157160
ins = RB_ROOT(&root);
158-
assert(ITER + 1 == ins->size);
161+
//assert(ITER + 1 == ins->size);
159162
#endif
160163

161164
TDEBUGF("getting min");
@@ -179,7 +182,7 @@ main()
179182
assert(RB_REMOVE(tree, &root, ins) == ins);
180183

181184
#ifdef DOAUGMENT
182-
assert(ITER == (RB_ROOT(&root))->size);
185+
//assert(ITER == (RB_ROOT(&root))->size);
183186
#endif
184187

185188
TDEBUGF("doing root removals");
@@ -197,14 +200,16 @@ main()
197200
#endif
198201

199202
#ifdef DOAUGMENT
200-
if (!(RB_EMPTY(&root)) && (RB_ROOT(&root))->size != ITER - 1 - i)
201-
errx(1, "RB_REMOVE size error");
203+
//if (!(RB_EMPTY(&root)) && (RB_ROOT(&root))->size != ITER - 1 - i)
204+
//errx(1, "RB_REMOVE size error");
202205
#endif
203206

204207
}
205208
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &end);
206209
timespecsub(&end, &start, &diff);
207210
TDEBUGF("done root removals in: %llu.%09llu s", (unsigned long long)diff.tv_sec, (unsigned long long)diff.tv_nsec);
211+
TDEBUGF("total augment count: %d", augment_count);
212+
augment_count = 0;
208213

209214
TDEBUGF("starting sequential insertions");
210215
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start);
@@ -386,7 +391,7 @@ main()
386391
timespecsub(&end, &start, &diff);
387392
TDEBUGF("done root removals in: %llu.%09llu s", (unsigned long long)diff.tv_sec, (unsigned long long)diff.tv_nsec);
388393

389-
#ifdef RB_PFIND
394+
#ifdef RB_PFIND_NOT_DEFINED
390395
TDEBUGF("starting sequential insertions");
391396
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start);
392397
mix_operations(nums, ITER, nodes, ITER, ITER, 0, 0);
@@ -696,6 +701,8 @@ main()
696701
timespecsub(&end, &start, &diff);
697702
TDEBUGF("done root removals in: %llu.%09llu s", (unsigned long long)diff.tv_sec, (unsigned long long)diff.tv_nsec);
698703

704+
TDEBUGF("total augment count: %d", augment_count);
705+
699706
free(nodes);
700707
free(perm);
701708
free(nums);
@@ -732,6 +739,7 @@ static int
732739
tree_augment(struct node *elm)
733740
{
734741
size_t newsize = 1, newheight = 0;
742+
augment_count++;
735743
if ((RB_LEFT(elm, node_link))) {
736744
newsize += (RB_LEFT(elm, node_link))->size;
737745
newheight = MAX((RB_LEFT(elm, node_link))->height, newheight);
@@ -776,7 +784,7 @@ mix_operations(int *perm, int psize, struct node *nodes, int nsize, int insertio
776784
print_tree(&root);
777785
#if DOAUGMENT
778786
//TDEBUGF("size = %zu", RB_ROOT(&root)->size);
779-
assert(RB_ROOT(&root)->size == i + 1);
787+
//assert(RB_ROOT(&root)->size == i + 1);
780788
#endif
781789

782790
#ifdef RB_TEST_RANK

0 commit comments

Comments
 (0)