|
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/lruhash.h"#include "util/storage/slabhash.h"Data Structures | |
| struct | test_thr |
| structure to threaded test the lru hash table More... | |
Macros | |
| #define | HASHTESTMAX 25 |
| number of hash test max | |
Typedefs | |
| typedef struct slabhash_testkey | testkey_type |
| use this type for the lruhash test key | |
| typedef struct slabhash_testdata | testdata_type |
| use this type for the lruhash test data | |
Functions | |
| static void | delkey (struct slabhash_testkey *k) |
| delete key | |
| static void | deldata (struct slabhash_testdata *d) |
| delete data | |
| static hashvalue_type | myhash (int id) |
| hash func, very bad to improve collisions | |
| static testkey_type * | newkey (int id) |
| allocate new key, fill in hash | |
| static testdata_type * | newdata (int val) |
| new data el | |
| static void | test_bin_find_entry (struct lruhash *table) |
| test bin_find_entry function and bin_overflow_remove | |
| static void | test_lru (struct lruhash *table) |
| test lru_front lru_remove | |
| static void | test_short_table (struct lruhash *table) |
| test hashtable using short sequence | |
| static void | testadd (struct lruhash *table, testdata_type *ref[]) |
| test adding a random element | |
| static void | testremove (struct lruhash *table, testdata_type *ref[]) |
| test adding a random element | |
| static void | testlookup (struct lruhash *table, testdata_type *ref[]) |
| test adding a random element | |
| static void | check_table (struct lruhash *table) |
| check integrity of hash table | |
| static void | testadd_unlim (struct lruhash *table, testdata_type **ref) |
| test adding a random element (unlimited range) | |
| static void | testremove_unlim (struct lruhash *table, testdata_type **ref) |
| test adding a random element (unlimited range) | |
| static void | testlookup_unlim (struct lruhash *table, testdata_type **ref) |
| test adding a random element (unlimited range) | |
| static void | test_long_table (struct lruhash *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 lruhash *table) |
| test hash table access by multiple threads | |
| void | lruhash_test (void) |
| unit test lruhashtable implementation | |
Tests the locking LRU keeping hash table implementation.
| #define HASHTESTMAX 25 |
number of hash test max
Referenced by test_long_table(), test_long_table(), testadd(), testadd(), testadd_unlim(), testadd_unlim(), testlookup(), testlookup(), testlookup_unlim(), testlookup_unlim(), testremove(), testremove(), testremove_unlim(), and testremove_unlim().
| typedef struct slabhash_testkey testkey_type |
use this type for the lruhash test key
use this type for the slabhash test key
| typedef struct slabhash_testdata testdata_type |
use this type for the lruhash test data
use this type for the slabhash test data
|
static |
delete key
References delkey(), slabhash_testkey::entry, and lruhash_entry::lock.
Referenced by delkey(), delkey(), delkey(), test_bin_find_entry(), test_lru(), testlookup(), testlookup(), testlookup_unlim(), testlookup_unlim(), testremove(), testremove(), testremove_unlim(), and testremove_unlim().
|
static |
|
static |
hash func, very bad to improve collisions
References myhash().
Referenced by myhash(), myhash(), newkey(), newkey(), test_bin_find_entry(), test_short_table(), test_short_table(), testadd(), testadd(), testadd_unlim(), testadd_unlim(), testlookup(), testlookup(), testlookup_unlim(), testlookup_unlim(), testremove(), testremove(), testremove_unlim(), and testremove_unlim().
|
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().
Referenced by newkey(), newkey(), test_bin_find_entry(), test_lru(), test_short_table(), test_short_table(), testadd(), testadd(), testadd_unlim(), testadd_unlim(), testlookup(), testlookup(), testlookup_unlim(), testlookup_unlim(), testremove(), testremove(), testremove_unlim(), and testremove_unlim().
|
static |
new data el
References slabhash_testdata::data, fatal_exit(), and newdata().
Referenced by newdata(), newdata(), test_bin_find_entry(), test_short_table(), test_short_table(), testadd(), testadd(), testadd_unlim(), and testadd_unlim().
|
static |
test bin_find_entry function and bin_overflow_remove
References bin_find_entry(), bin_init(), bin_overflow_remove(), deldata(), delkey(), slabhash_testkey::entry, lruhash_entry::hash, lruhash_bin::lock, myhash(), newdata(), newkey(), lruhash_bin::overflow_list, lruhash_entry::overflow_next, test_bin_find_entry(), and unit_assert.
Referenced by lruhash_test(), and test_bin_find_entry().
|
static |
test lru_front lru_remove
References delkey(), slabhash_testkey::entry, lruhash::lock, lruhash::lru_end, lru_front(), lru_remove(), lruhash::lru_start, newkey(), test_lru(), and unit_assert.
Referenced by lruhash_test(), and test_lru().
|
static |
test hashtable using short sequence
References lruhash_entry::data, slabhash_testkey::entry, lruhash_entry::lock, lruhash_insert(), lruhash_lookup(), lruhash_remove(), myhash(), newdata(), newkey(), test_short_table(), and unit_assert.
Referenced by lruhash_test(), slabhash_test(), test_short_table(), and test_short_table().
|
static |
test adding a random element
References lruhash_entry::data, slabhash_testkey::entry, HASHTESTMAX, lruhash_insert(), myhash(), newdata(), newkey(), and testadd().
Referenced by test_long_table(), test_long_table(), testadd(), and testadd().
|
static |
test adding a random element
References delkey(), HASHTESTMAX, lruhash_remove(), myhash(), newkey(), and testremove().
Referenced by test_long_table(), test_long_table(), testremove(), 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(), lruhash_lookup(), myhash(), newkey(), testlookup(), and unit_assert.
Referenced by test_long_table(), test_long_table(), testlookup(), and testlookup().
|
static |
check integrity of hash table
References check_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_table(), check_table(), test_long_table(), test_long_table(), test_thr_main(), and test_thr_main().
|
static |
test adding a random element (unlimited range)
References lruhash_entry::data, HASHTESTMAX, lruhash_entry::key, lruhash_insert(), myhash(), newdata(), newkey(), and testadd_unlim().
Referenced by test_long_table(), test_long_table(), test_thr_main(), test_thr_main(), testadd_unlim(), and testadd_unlim().
|
static |
test adding a random element (unlimited range)
References delkey(), HASHTESTMAX, lruhash_entry::key, lruhash_remove(), myhash(), newkey(), and testremove_unlim().
Referenced by test_long_table(), test_long_table(), test_thr_main(), test_thr_main(), testremove_unlim(), 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(), lruhash_lookup(), myhash(), newkey(), testlookup_unlim(), and unit_assert.
Referenced by test_long_table(), test_long_table(), test_thr_main(), test_thr_main(), testlookup_unlim(), and testlookup_unlim().
|
static |
test with long sequence of adds, removes and updates, and lookups
References check_table(), HASHTESTMAX, log_info(), lruhash_clear(), lruhash_status(), lruhash::num, lruhash::space_max, test_long_table(), testadd(), testadd_unlim(), testlookup(), testlookup_unlim(), testremove(), testremove_unlim(), and unit_assert.
Referenced by lruhash_test(), slabhash_test(), test_long_table(), and test_long_table().
|
static |
main routine for threaded hash table test
References check_table(), log_thread_set(), lruhash_status(), test_thr::num, test_thr::table, test_thr_main(), testadd_unlim(), testlookup_unlim(), testremove_unlim(), and unit_assert.
Referenced by test_thr_main(), test_thr_main(), test_threaded_table(), and test_threaded_table().
|
static |
test hash table access by multiple threads
References lruhash_status(), test_thr::num, test_thr::table, test_thr_main(), and test_threaded_table().
Referenced by lruhash_test(), slabhash_test(), test_threaded_table(), and test_threaded_table().
| void lruhash_test | ( | void | ) |
unit test lruhashtable implementation
References lruhash_create(), lruhash_delete(), lruhash_test(), test_bin_find_entry(), test_long_table(), test_lru(), test_short_table(), test_slabhash_compfunc(), test_threaded_table(), and unit_show_feature().
Referenced by lruhash_test(), and main().