regressions: Coverage for ck_ht delete workload hint.

ck_pring
Samy Al Bahra 11 years ago
parent eb59f6ead5
commit 207884f9e3

@ -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

@ -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);
}

@ -280,6 +280,7 @@ main(int argc, char *argv[])
if (argc < 2) {
fprintf(stderr, "Usage: parallel <#entries> [<interval length> <initial size> <readers>\n"
" <probability of replacement> <probability of deletion> <epoch threshold>]\n");
exit(EXIT_FAILURE);
}
if (argc >= 3)

@ -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);
}

@ -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

@ -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");
}

Loading…
Cancel
Save