From 207884f9e3335025cb04686c78876cb3fefd8221 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Mon, 16 Dec 2013 16:03:10 -0500 Subject: [PATCH] regressions: Coverage for ck_ht delete workload hint. --- regressions/ck_ht/benchmark/Makefile | 8 +++++++- regressions/ck_ht/benchmark/parallel_bytestring.c | 7 ++++++- regressions/ck_ht/benchmark/parallel_direct.c | 1 + regressions/ck_ht/benchmark/serial.c | 7 ++++++- regressions/ck_ht/validate/Makefile | 6 +++++- regressions/ck_ht/validate/serial.c | 9 +++++++-- 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/regressions/ck_ht/benchmark/Makefile b/regressions/ck_ht/benchmark/Makefile index 8e21d5b..fa31274 100644 --- a/regressions/ck_ht/benchmark/Makefile +++ b/regressions/ck_ht/benchmark/Makefile @@ -1,12 +1,18 @@ .PHONY: clean distribution -OBJECTS=serial parallel_bytestring parallel_direct +OBJECTS=serial serial.delete parallel_bytestring parallel_bytestring.delete parallel_direct all: $(OBJECTS) serial: serial.c ../../../include/ck_ht.h ../../../src/ck_ht.c $(CC) $(CFLAGS) -o serial serial.c ../../../src/ck_ht.c +serial.delete: serial.c ../../../include/ck_ht.h ../../../src/ck_ht.c + $(CC) $(CFLAGS) -DHT_DELETE -o serial.delete serial.c ../../../src/ck_ht.c + +parallel_bytestring.delete: parallel_bytestring.c ../../../include/ck_ht.h ../../../src/ck_ht.c ../../../src/ck_epoch.c + $(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -DHT_DELETE -o parallel_bytestring.delete parallel_bytestring.c ../../../src/ck_ht.c ../../../src/ck_epoch.c + parallel_bytestring: parallel_bytestring.c ../../../include/ck_ht.h ../../../src/ck_ht.c ../../../src/ck_epoch.c $(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -o parallel_bytestring parallel_bytestring.c ../../../src/ck_ht.c ../../../src/ck_epoch.c diff --git a/regressions/ck_ht/benchmark/parallel_bytestring.c b/regressions/ck_ht/benchmark/parallel_bytestring.c index f530788..8792bdc 100644 --- a/regressions/ck_ht/benchmark/parallel_bytestring.c +++ b/regressions/ck_ht/benchmark/parallel_bytestring.c @@ -124,11 +124,16 @@ static struct ck_malloc my_allocator = { static void table_init(void) { + unsigned int mode = CK_HT_MODE_BYTESTRING; + +#ifdef HT_DELETE + mode |= CK_HT_WORKLOAD_DELETE; +#endif ck_epoch_init(&epoch_ht); ck_epoch_register(&epoch_ht, &epoch_wr); common_srand48((long int)time(NULL)); - if (ck_ht_init(&ht, CK_HT_MODE_BYTESTRING, NULL, &my_allocator, 8, common_lrand48()) == false) { + if (ck_ht_init(&ht, mode, NULL, &my_allocator, 8, common_lrand48()) == false) { perror("ck_ht_init"); exit(EXIT_FAILURE); } diff --git a/regressions/ck_ht/benchmark/parallel_direct.c b/regressions/ck_ht/benchmark/parallel_direct.c index 94e3e22..093c75b 100644 --- a/regressions/ck_ht/benchmark/parallel_direct.c +++ b/regressions/ck_ht/benchmark/parallel_direct.c @@ -280,6 +280,7 @@ main(int argc, char *argv[]) if (argc < 2) { fprintf(stderr, "Usage: parallel <#entries> [ \n" " ]\n"); + exit(EXIT_FAILURE); } if (argc >= 3) diff --git a/regressions/ck_ht/benchmark/serial.c b/regressions/ck_ht/benchmark/serial.c index 6189820..776f021 100644 --- a/regressions/ck_ht/benchmark/serial.c +++ b/regressions/ck_ht/benchmark/serial.c @@ -71,9 +71,14 @@ static struct ck_malloc my_allocator = { static void table_init(void) { + unsigned int mode = CK_HT_MODE_BYTESTRING; + +#ifdef HT_DELETE + mode |= CK_HT_WORKLOAD_DELETE; +#endif common_srand48((long int)time(NULL)); - if (ck_ht_init(&ht, CK_HT_MODE_BYTESTRING, NULL, &my_allocator, 8, common_lrand48()) == false) { + if (ck_ht_init(&ht, mode, NULL, &my_allocator, 8, common_lrand48()) == false) { perror("ck_ht_init"); exit(EXIT_FAILURE); } diff --git a/regressions/ck_ht/validate/Makefile b/regressions/ck_ht/validate/Makefile index 5942975..cb5682c 100644 --- a/regressions/ck_ht/validate/Makefile +++ b/regressions/ck_ht/validate/Makefile @@ -1,14 +1,18 @@ .PHONY: check clean distribution -OBJECTS=serial +OBJECTS=serial serial.delete all: $(OBJECTS) serial: serial.c ../../../include/ck_ht.h ../../../src/ck_ht.c $(CC) $(CFLAGS) -o serial serial.c ../../../src/ck_ht.c +serial.delete: serial.c ../../../include/ck_ht.h ../../../src/ck_ht.c + $(CC) $(CFLAGS) -DHT_DELETE -o serial.delete serial.c ../../../src/ck_ht.c + check: all ./serial + ./serial.delete clean: rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe diff --git a/regressions/ck_ht/validate/serial.c b/regressions/ck_ht/validate/serial.c index 446da5c..30e73a8 100644 --- a/regressions/ck_ht/validate/serial.c +++ b/regressions/ck_ht/validate/serial.c @@ -77,8 +77,13 @@ main(void) ck_ht_hash_t h; ck_ht_iterator_t iterator = CK_HT_ITERATOR_INITIALIZER; ck_ht_entry_t *cursor; + unsigned int mode = CK_HT_MODE_BYTESTRING; - if (ck_ht_init(&ht, CK_HT_MODE_BYTESTRING, NULL, &my_allocator, 8, 6602834) == false) { +#ifdef HT_DELETE + mode |= CK_HT_WORKLOAD_DELETE; +#endif + + if (ck_ht_init(&ht, mode, NULL, &my_allocator, 16, 6602834) == false) { perror("ck_ht_init"); exit(EXIT_FAILURE); } @@ -187,7 +192,7 @@ main(void) } } - if (ck_ht_gc(&ht, 0, 0) == false) { + if (ck_ht_gc(&ht, 0, 27) == false) { ck_error("ck_ht_gc\n"); }