Asterisk - The Open Source Telephony Project GIT-master-b023714
|
#include "asterisk.h"
#include <pthread.h>
#include "asterisk/astobj2.h"
#include "asterisk/hashtab.h"
#include "asterisk/lock.h"
#include "asterisk/module.h"
#include "asterisk/test.h"
#include "asterisk/time.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Data Structures | |
struct | hash_test |
Macros | |
#define | COUNT_SLEEP_US 500 |
#define | HASH_BUCKETS 151 |
#define | MAX_HASH_ENTRIES 15000 |
#define | MAX_TEST_SECONDS 60 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (hash_test) | |
static int | compare_strings (void *lhs, void *rhs, int flags) |
static int | hash_string (const void *obj, const int flags) |
static void * | hash_test_count (void *d) |
static void * | hash_test_grow (void *d) |
Grow the hash data as specified. | |
static void * | hash_test_lookup (void *d) |
static void * | hash_test_shrink (void *d) |
static void | ht_delete (void *obj) |
Free test element. | |
static char * | ht_new (int i) |
Create test element. | |
static int | increment_count (void *obj, void *arg, int flags) |
static int | is_timed_out (struct hash_test const *data) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "astobj2 container thrash test" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
static int | alloc_count = 0 |
static const struct ast_module_info * | ast_module_info = &__mod_info |
#define COUNT_SLEEP_US 500 |
Definition at line 54 of file test_astobj2_thrash.c.
#define HASH_BUCKETS 151 |
Definition at line 52 of file test_astobj2_thrash.c.
#define MAX_HASH_ENTRIES 15000 |
Definition at line 47 of file test_astobj2_thrash.c.
#define MAX_TEST_SECONDS 60 |
Definition at line 55 of file test_astobj2_thrash.c.
|
static |
Definition at line 359 of file test_astobj2_thrash.c.
|
static |
Definition at line 359 of file test_astobj2_thrash.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 359 of file test_astobj2_thrash.c.
AST_TEST_DEFINE | ( | hash_test | ) |
Definition at line 247 of file test_astobj2_thrash.c.
References alloc_count, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_container_count(), ao2_link, ao2_ref, ast_atomic_fetchadd_int(), ast_pthread_create, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tv(), ast_tvadd(), ast_tvnow(), compare_strings(), hash_test::deadline, HASH_BUCKETS, hash_string(), hash_test_count(), hash_test_grow(), hash_test_lookup(), hash_test_shrink(), ht_new(), hash_test::max_grow, MAX_HASH_ENTRIES, MAX_TEST_SECONDS, NULL, hash_test::preload, TEST_EXECUTE, TEST_INIT, and hash_test::to_be_thrashed.
|
static |
Definition at line 236 of file test_astobj2_thrash.c.
References CMP_MATCH, and CMP_STOP.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 231 of file test_astobj2_thrash.c.
References ast_hashtab_hash_string_nocase().
Referenced by AST_TEST_DEFINE().
|
static |
Continuously iterate through all the entries in the hash
Definition at line 203 of file test_astobj2_thrash.c.
References ao2_callback, COUNT_SLEEP_US, d, increment_count(), is_timed_out(), hash_test::max_grow, NULL, OBJ_MULTIPLE, and hash_test::to_be_thrashed.
Referenced by AST_TEST_DEFINE().
|
static |
Grow the hash data as specified.
Definition at line 98 of file test_astobj2_thrash.c.
References ao2_link, ao2_ref, ast_atomic_fetchadd_int(), d, hash_test::grow_count, ht_new(), is_timed_out(), hash_test::max_grow, NULL, and hash_test::to_be_thrashed.
Referenced by AST_TEST_DEFINE().
|
static |
Randomly lookup data in the hash
Definition at line 121 of file test_astobj2_thrash.c.
References ao2_find, ao2_ref, ast_atomic_fetchadd_int(), d, hash_test::grow_count, ht_new(), is_timed_out(), max, hash_test::max_grow, NULL, OBJ_POINTER, and hash_test::to_be_thrashed.
Referenced by AST_TEST_DEFINE().
|
static |
Delete entries from the hash
Definition at line 163 of file test_astobj2_thrash.c.
References ao2_find, ao2_ref, d, ht_new(), is_timed_out(), NULL, OBJ_POINTER, OBJ_UNLINK, hash_test::preload, and hash_test::to_be_thrashed.
Referenced by AST_TEST_DEFINE().
|
static |
Free test element.
Definition at line 77 of file test_astobj2_thrash.c.
References alloc_count, and ast_atomic_fetchadd_int().
Referenced by ht_new().
|
static |
Create test element.
Definition at line 83 of file test_astobj2_thrash.c.
References alloc_count, ao2_alloc, ast_assert, ast_atomic_fetchadd_int(), ht_delete(), and NULL.
Referenced by AST_TEST_DEFINE(), hash_test_grow(), hash_test_lookup(), and hash_test_shrink().
|
static |
ao2_callback for hash_test_count
Definition at line 193 of file test_astobj2_thrash.c.
Referenced by hash_test_count().
|
static |
Definition at line 72 of file test_astobj2_thrash.c.
References ast_tvdiff_us(), ast_tvnow(), and hash_test::deadline.
Referenced by hash_test_count(), hash_test_grow(), hash_test_lookup(), and hash_test_shrink().
|
static |
Definition at line 353 of file test_astobj2_thrash.c.
References AST_MODULE_LOAD_SUCCESS, and AST_TEST_REGISTER.
|
static |
Definition at line 347 of file test_astobj2_thrash.c.
References AST_TEST_UNREGISTER.
|
static |
Definition at line 359 of file test_astobj2_thrash.c.
|
static |
Definition at line 70 of file test_astobj2_thrash.c.
Referenced by AST_TEST_DEFINE(), ht_delete(), and ht_new().
|
static |
Definition at line 359 of file test_astobj2_thrash.c.