|
unbound 0.1
|
Tests the locking LRU keeping hash table implementation. More...
#include "config.h"#include "testcode/unitmain.h"#include "util/log.h"#include "util/storage/slabhash.h"Data Structures | |
| struct | slab_test_thr |
| structure to threaded test the lru hash table More... | |
Macros | |
| #define | HASHTESTMAX 32 |
| number of hash test max | |
Functions | |
| static void | delkey (struct slabhash_testkey *k) |
| delete key | |
| static hashvalue_type | myhash (int id) |
| hash func, very bad to improve collisions, both high and low bits | |
| static testkey_type * | newkey (int id) |
| allocate new key, fill in hash | |
| static testdata_type * | newdata (int val) |
| new data el | |
| static void | test_short_table (struct slabhash *table) |
| test hashtable using short sequence | |
| static void | testadd (struct slabhash *table, testdata_type *ref[]) |
| test adding a random element | |
| static void | testremove (struct slabhash *table, testdata_type *ref[]) |
| test adding a random element | |
| static void | testlookup (struct slabhash *table, testdata_type *ref[]) |
| test adding a random element | |
| static void | check_lru_table (struct lruhash *table) |
| check integrity of hash table | |
| static void | check_table (struct slabhash *table) |
| check integrity of hash table | |
| static void | testadd_unlim (struct slabhash *table, testdata_type **ref) |
| test adding a random element (unlimited range) | |
| static void | testremove_unlim (struct slabhash *table, testdata_type **ref) |
| test adding a random element (unlimited range) | |
| static void | testlookup_unlim (struct slabhash *table, testdata_type **ref) |
| test adding a random element (unlimited range) | |
| static void | test_long_table (struct slabhash *table) |
| test with long sequence of adds, removes and updates, and lookups | |
| static void * | test_thr_main (void *arg) |
| main routine for threaded hash table test | |
| static void | test_threaded_table (struct slabhash *table) |
| test hash table access by multiple threads | |
| void | slabhash_test (void) |
| unit test slabhashtable implementation | |
Tests the locking LRU keeping hash table implementation.
|
static |
delete key
References delkey(), slabhash_testkey::entry, and lruhash_entry::lock.
|
static |
hash func, very bad to improve collisions, both high and low bits
References myhash().
|
static |
allocate new key, fill in hash
References slabhash_testkey::entry, fatal_exit(), lruhash_entry::hash, slabhash_testkey::id, lruhash_entry::key, lruhash_entry::lock, myhash(), and newkey().
|
static |
new data el
References slabhash_testdata::data, fatal_exit(), and newdata().
|
static |
test hashtable using short sequence
References lruhash_entry::data, slabhash_testkey::entry, lruhash_entry::lock, myhash(), newdata(), newkey(), slabhash_insert(), slabhash_lookup(), slabhash_remove(), test_short_table(), and unit_assert.
|
static |
test adding a random element
References lruhash_entry::data, slabhash_testdata::data, slabhash_testkey::entry, HASHTESTMAX, myhash(), newdata(), newkey(), slabhash_insert(), and testadd().
|
static |
test adding a random element
References delkey(), HASHTESTMAX, myhash(), newkey(), slabhash_remove(), and testremove().
|
static |
test adding a random element
References lruhash_entry::data, slabhash_testdata::data, delkey(), HASHTESTMAX, lruhash_entry::key, lruhash_entry::lock, log_info(), myhash(), newkey(), slabhash_lookup(), testlookup(), and unit_assert.
|
static |
check integrity of hash table
References check_lru_table(), lruhash::lock, lruhash::lru_end, lruhash_entry::lru_next, lruhash_entry::lru_prev, lruhash::lru_start, lruhash::num, lruhash::size, lruhash::size_mask, lruhash::space_max, lruhash::space_used, and unit_assert.
Referenced by check_lru_table(), and check_table().
|
static |
check integrity of hash table
References slabhash::array, check_lru_table(), check_table(), and slabhash::size.
|
static |
test adding a random element (unlimited range)
References lruhash_entry::data, HASHTESTMAX, lruhash_entry::key, myhash(), newdata(), newkey(), slabhash_insert(), and testadd_unlim().
|
static |
test adding a random element (unlimited range)
References delkey(), HASHTESTMAX, lruhash_entry::key, myhash(), newkey(), slabhash_remove(), and testremove_unlim().
|
static |
test adding a random element (unlimited range)
References lruhash_entry::data, slabhash_testdata::data, delkey(), HASHTESTMAX, lruhash_entry::key, lruhash_entry::lock, log_info(), myhash(), newkey(), slabhash_lookup(), testlookup_unlim(), and unit_assert.
|
static |
test with long sequence of adds, removes and updates, and lookups
References check_table(), HASHTESTMAX, slabhash_clear(), slabhash_status(), test_long_table(), testadd(), testadd_unlim(), testlookup(), testlookup_unlim(), testremove(), testremove_unlim(), and unit_assert.
|
static |
main routine for threaded hash table test
References check_table(), log_thread_set(), slab_test_thr::num, slabhash_status(), slab_test_thr::table, test_thr_main(), testadd_unlim(), testlookup_unlim(), testremove_unlim(), and unit_assert.
|
static |
test hash table access by multiple threads
References slab_test_thr::num, slabhash_status(), slab_test_thr::table, test_thr_main(), and test_threaded_table().
| void slabhash_test | ( | void | ) |
unit test slabhashtable implementation
References slabhash_create(), slabhash_delete(), slabhash_test(), test_long_table(), test_short_table(), test_slabhash_compfunc(), test_threaded_table(), and unit_show_feature().
Referenced by main(), and slabhash_test().