Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
#include "asterisk.h"
#include <pthread.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 | MAX_HASH_ENTRIES 30000 |
#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 void * | hash_test_count (void *d) |
static void * | hash_test_grow (void *d) |
Grow the hash data as specified. More... | |
static void * | hash_test_lookup (void *d) |
static void * | hash_test_shrink (void *d) |
static void | ht_delete (void *obj) |
Free test element. More... | |
static char * | ht_new (int i) |
Create test element. More... | |
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 = "Hash 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 const struct ast_module_info * | ast_module_info = &__mod_info |
#define MAX_HASH_ENTRIES 30000 |
Definition at line 46 of file test_hashtab_thrash.c.
#define MAX_TEST_SECONDS 60 |
Definition at line 47 of file test_hashtab_thrash.c.
|
static |
Definition at line 333 of file test_hashtab_thrash.c.
|
static |
Definition at line 333 of file test_hashtab_thrash.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 333 of file test_hashtab_thrash.c.
AST_TEST_DEFINE | ( | hash_test | ) |
Definition at line 227 of file test_hashtab_thrash.c.
References ast_hashtab_compare_strings_nocase(), ast_hashtab_create, ast_hashtab_destroy(), ast_hashtab_hash_string_nocase(), ast_hashtab_insert_immediate, ast_hashtab_newsize_java(), ast_hashtab_resize_java(), ast_hashtab_size(), ast_pthread_create, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tv(), ast_tvadd(), ast_tvnow(), hash_test::deadline, hash_test_count(), hash_test_grow(), hash_test_lookup(), hash_test_shrink(), ht_delete(), ht_new(), sip_to_pjsip::info(), hash_test::max_grow, MAX_HASH_ENTRIES, MAX_TEST_SECONDS, NULL, hash_test::preload, hash_test::test, TEST_EXECUTE, TEST_INIT, and hash_test::to_be_thrashed.
|
static |
Continuously iterate through all the entries in the hash
Definition at line 188 of file test_hashtab_thrash.c.
References ast_hashtab_end_traversal(), ast_hashtab_next(), ast_hashtab_start_write_traversal, d, is_timed_out(), hash_test::max_grow, NULL, and hash_test::to_be_thrashed.
Referenced by AST_TEST_DEFINE().
|
static |
Grow the hash data as specified.
Definition at line 97 of file test_hashtab_thrash.c.
References ast_atomic_fetchadd_int(), ast_hashtab_insert_immediate, 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 118 of file test_hashtab_thrash.c.
References ast_atomic_fetchadd_int(), ast_hashtab_lookup(), d, hash_test::grow_count, ht_delete(), ht_new(), is_timed_out(), max, hash_test::max_grow, NULL, and hash_test::to_be_thrashed.
Referenced by AST_TEST_DEFINE().
|
static |
Delete entries from the hash
Definition at line 159 of file test_hashtab_thrash.c.
References ast_hashtab_remove_object_via_lookup(), d, ht_delete(), ht_new(), is_timed_out(), NULL, hash_test::preload, and hash_test::to_be_thrashed.
Referenced by AST_TEST_DEFINE().
|
static |
Free test element.
Definition at line 91 of file test_hashtab_thrash.c.
References ast_free.
Referenced by AST_TEST_DEFINE(), hash_test_lookup(), and hash_test_shrink().
|
static |
Create test element.
Definition at line 77 of file test_hashtab_thrash.c.
References ast_assert, ast_malloc, and NULL.
Referenced by AST_TEST_DEFINE(), hash_test_grow(), hash_test_lookup(), and hash_test_shrink().
|
static |
Definition at line 64 of file test_hashtab_thrash.c.
References ast_test_status_update, ast_tvdiff_us(), ast_tvnow(), hash_test::deadline, and hash_test::test.
Referenced by hash_test_count(), hash_test_grow(), hash_test_lookup(), and hash_test_shrink().
|
static |
Definition at line 327 of file test_hashtab_thrash.c.
References AST_MODULE_LOAD_SUCCESS, and AST_TEST_REGISTER.
|
static |
Definition at line 321 of file test_hashtab_thrash.c.
References AST_TEST_UNREGISTER.
|
static |
Definition at line 333 of file test_hashtab_thrash.c.
|
static |
Definition at line 333 of file test_hashtab_thrash.c.