projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rculfhash: garbage collection scheme
[urcu.git]
/
tests
/
test_urcu_hash.c
diff --git
a/tests/test_urcu_hash.c
b/tests/test_urcu_hash.c
index 44b9531b2fb8080b1a7e5bf02320669374f5bc6e..ba8f9e93c2697e126786c7d16e9cd9e7bc3f339c 100644
(file)
--- a/
tests/test_urcu_hash.c
+++ b/
tests/test_urcu_hash.c
@@
-38,7
+38,7
@@
#endif
#define HASH_SIZE 32
#endif
#define HASH_SIZE 32
-#define RAND_POOL 1000
+#define RAND_POOL 1000
0
/* Make this big enough to include the POWER5+ L3 cacheline size of 256B */
#define CACHE_LINE_SIZE 4096
/* Make this big enough to include the POWER5+ L3 cacheline size of 256B */
#define CACHE_LINE_SIZE 4096
@@
-403,13
+403,13
@@
void *thr_writer(void *_count)
rcu_read_lock();
ht_node_init(node,
(void *)(unsigned long)(rand_r(&rand_lookup) % RAND_POOL),
rcu_read_lock();
ht_node_init(node,
(void *)(unsigned long)(rand_r(&rand_lookup) % RAND_POOL),
- sizeof(void *),
- (void *) 0x42);
+ sizeof(void *));
ret = ht_add_unique(test_ht, node);
rcu_read_unlock();
ret = ht_add_unique(test_ht, node);
rcu_read_unlock();
- if (ret)
+ if (ret) {
+ free(node);
nr_addexist++;
nr_addexist++;
- else
+
}
else
nr_add++;
} else {
/* May delete */
nr_add++;
} else {
/* May delete */
@@
-594,8
+594,13
@@
int main(int argc, char **argv)
tot_writes += count_writer[i];
}
ret = ht_destroy(test_ht);
tot_writes += count_writer[i];
}
ret = ht_destroy(test_ht);
- if (ret)
- printf("WARNING: nodes left in the hash table upon destroy\n");
+ if (ret) {
+ unsigned long count, removed;
+
+ ht_count_nodes(test_ht, &count, &removed);
+ printf("WARNING: nodes left in the hash table upon destroy: "
+ "%lu nodes + %lu logically removed.\n", count, removed);
+ }
printf_verbose("final delete: %d items\n", ret);
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
printf_verbose("final delete: %d items\n", ret);
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
This page took
0.023063 seconds
and
4
git commands to generate.