Asterisk - The Open Source Telephony Project
18.5.0
|
#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) |
static void * | hash_test_lookup (void *d) |
static void * | hash_test_shrink (void *d) |
static void | ht_delete (void *obj) |
static char * | ht_new (int i) |
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 = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .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.
Referenced by hash_test_count().
#define HASH_BUCKETS 151 |
Definition at line 52 of file test_astobj2_thrash.c.
Referenced by AST_TEST_DEFINE().
#define MAX_HASH_ENTRIES 15000 |
Definition at line 47 of file test_astobj2_thrash.c.
Referenced by AST_TEST_DEFINE().
#define MAX_TEST_SECONDS 60 |
Definition at line 55 of file test_astobj2_thrash.c.
Referenced by AST_TEST_DEFINE().
|
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(), sip_to_pjsip::info(), 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 |
/brief 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 |
/brief 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 |
/brief 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.