Asterisk - The Open Source Telephony Project GIT-master-a63eec2
|
taskpool unit tests More...
#include "asterisk.h"
#include "asterisk/astobj2.h"
#include "asterisk/lock.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/test.h"
#include "asterisk/taskpool.h"
#include "asterisk/cli.h"
Go to the source code of this file.
Data Structures | |
struct | efficiency_task_data |
struct | serializer_efficiency_task_data |
struct | test_data |
Sorcery object created based on backend data. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (taskpool_push) | |
AST_TEST_DEFINE (taskpool_push_grow) | |
AST_TEST_DEFINE (taskpool_push_serializer) | |
AST_TEST_DEFINE (taskpool_push_serializer_synchronous) | |
AST_TEST_DEFINE (taskpool_push_serializer_synchronous_requeue) | |
AST_TEST_DEFINE (taskpool_push_shrink) | |
AST_TEST_DEFINE (taskpool_push_synchronous) | |
static int | efficiency_task (void *data) |
static char * | handle_cli_taskpool_push_efficiency (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_taskpool_push_serializer_efficiency (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | load_module (void) |
static int | requeue_task (void *data) |
static int | serializer_efficiency_task (void *data) |
static int | simple_task (void *data) |
static struct test_data * | test_alloc (void) |
static void | test_destroy (struct test_data *td) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "taskpool test module" , .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 const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_cli_entry | cli [] |
taskpool unit tests
Definition in file test_taskpool.c.
|
static |
Definition at line 810 of file test_taskpool.c.
|
static |
Definition at line 810 of file test_taskpool.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 810 of file test_taskpool.c.
AST_TEST_DEFINE | ( | taskpool_push | ) |
Definition at line 78 of file test_taskpool.c.
References ast_cond_timedwait, ast_mutex_lock, ast_mutex_unlock, ast_taskpool_create(), AST_TASKPOOL_OPTIONS_VERSION, ast_taskpool_push(), ast_taskpool_shutdown(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tvnow(), test_data::cond, end, test_data::executed, test_data::lock, NULL, options, simple_task(), test_alloc(), test_destroy(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | taskpool_push_grow | ) |
Definition at line 393 of file test_taskpool.c.
References ast_cond_timedwait, ast_mutex_lock, ast_mutex_unlock, ast_taskpool_create(), AST_TASKPOOL_OPTIONS_VERSION, ast_taskpool_push(), ast_taskpool_shutdown(), ast_taskpool_taskprocessors_count(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tvnow(), test_data::cond, end, test_data::executed, test_data::lock, NULL, options, simple_task(), test_alloc(), test_destroy(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | taskpool_push_serializer | ) |
Definition at line 190 of file test_taskpool.c.
References ast_cond_timedwait, ast_mutex_lock, ast_mutex_unlock, ast_taskpool_create(), AST_TASKPOOL_OPTIONS_VERSION, ast_taskpool_serializer(), ast_taskpool_shutdown(), ast_taskprocessor_push(), ast_taskprocessor_unreference(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tvnow(), test_data::cond, end, test_data::executed, test_data::lock, NULL, options, simple_task(), test_data::taskprocessor, test_alloc(), test_destroy(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | taskpool_push_serializer_synchronous | ) |
Definition at line 264 of file test_taskpool.c.
References ast_taskpool_create(), AST_TASKPOOL_OPTIONS_VERSION, ast_taskpool_serializer(), ast_taskpool_serializer_push_wait(), ast_taskpool_shutdown(), ast_taskprocessor_unreference(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, end, test_data::executed, NULL, options, simple_task(), test_data::taskprocessor, test_alloc(), test_destroy(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | taskpool_push_serializer_synchronous_requeue | ) |
Definition at line 331 of file test_taskpool.c.
References ast_taskpool_create(), AST_TASKPOOL_OPTIONS_VERSION, ast_taskpool_serializer(), ast_taskpool_serializer_push_wait(), ast_taskpool_shutdown(), ast_taskprocessor_unreference(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, end, test_data::executed, NULL, options, requeue_task(), test_data::taskprocessor, test_alloc(), test_destroy(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | taskpool_push_shrink | ) |
Definition at line 467 of file test_taskpool.c.
References ast_cond_timedwait, ast_mutex_lock, ast_taskpool_create(), AST_TASKPOOL_OPTIONS_VERSION, ast_taskpool_push(), ast_taskpool_shutdown(), ast_taskpool_taskprocessors_count(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tvnow(), test_data::cond, end, test_data::executed, test_data::lock, NULL, options, simple_task(), test_alloc(), test_destroy(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | taskpool_push_synchronous | ) |
Definition at line 140 of file test_taskpool.c.
References ast_taskpool_create(), AST_TASKPOOL_OPTIONS_VERSION, ast_taskpool_push_wait(), ast_taskpool_shutdown(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, end, test_data::executed, NULL, options, simple_task(), test_alloc(), test_destroy(), TEST_EXECUTE, and TEST_INIT.
|
static |
Definition at line 559 of file test_taskpool.c.
References ao2_ref, ast_atomic_fetchadd_int(), ast_taskpool_push(), efficiency_task(), efficiency_task_data::num_tasks_executed, efficiency_task_data::pool, and efficiency_task_data::shutdown.
Referenced by efficiency_task(), and handle_cli_taskpool_push_efficiency().
|
static |
Definition at line 578 of file test_taskpool.c.
References a, ao2_bump, ast_cli(), ast_cond_timedwait, ast_mutex_lock, ast_mutex_unlock, ast_taskpool_create(), AST_TASKPOOL_OPTIONS_VERSION, ast_taskpool_push(), ast_taskpool_shutdown(), ast_tvnow(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, test_data::cond, efficiency_task(), end, test_data::lock, NULL, efficiency_task_data::num_tasks_executed, options, efficiency_task_data::pool, efficiency_task_data::shutdown, test_alloc(), test_destroy(), and ast_cli_entry::usage.
|
static |
Definition at line 685 of file test_taskpool.c.
References a, ast_cli(), ast_cond_timedwait, ast_mutex_lock, ast_mutex_unlock, ast_taskpool_create(), AST_TASKPOOL_OPTIONS_VERSION, ast_taskpool_serializer(), ast_taskpool_shutdown(), ast_taskprocessor_build_name(), AST_TASKPROCESSOR_MAX_NAME, ast_taskprocessor_push(), ast_taskprocessor_unreference(), ast_tvnow(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, test_data::cond, end, test_data::lock, NULL, serializer_efficiency_task_data::num_tasks_executed, options, serializer_efficiency_task_data::serializer, serializer_efficiency_task(), serializer_efficiency_task_data::shutdown, test_alloc(), test_destroy(), and ast_cli_entry::usage.
|
static |
Definition at line 797 of file test_taskpool.c.
References ARRAY_LEN, ast_cli_register_multiple, AST_MODULE_LOAD_SUCCESS, AST_TEST_REGISTER, and cli.
|
static |
Definition at line 326 of file test_taskpool.c.
References ast_taskpool_serializer_get_current(), ast_taskpool_serializer_push_wait(), and simple_task().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 658 of file test_taskpool.c.
References ast_atomic_fetchadd_int(), ast_taskpool_serializer_get_current(), ast_taskprocessor_push(), serializer_efficiency_task_data::num_tasks_executed, serializer_efficiency_task_data::serializer, serializer_efficiency_task(), and serializer_efficiency_task_data::shutdown.
Referenced by handle_cli_taskpool_push_serializer_efficiency(), and serializer_efficiency_task().
|
static |
Definition at line 68 of file test_taskpool.c.
References ast_cond_signal, ast_taskpool_serializer_get_current(), test_data::cond, test_data::executed, lock, test_data::lock, SCOPED_MUTEX, and test_data::taskprocessor.
Referenced by AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), and requeue_task().
|
static |
Definition at line 50 of file test_taskpool.c.
References ast_calloc, ast_cond_init, ast_mutex_init, test_data::cond, test_data::lock, and NULL.
Referenced by AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), handle_cli_taskpool_push_efficiency(), and handle_cli_taskpool_push_serializer_efficiency().
|
static |
Definition at line 61 of file test_taskpool.c.
References ast_cond_destroy, ast_free, ast_mutex_destroy, test_data::cond, and test_data::lock.
Referenced by AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), handle_cli_taskpool_push_efficiency(), and handle_cli_taskpool_push_serializer_efficiency().
|
static |
Definition at line 784 of file test_taskpool.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), AST_TEST_UNREGISTER, and cli.
|
static |
Definition at line 810 of file test_taskpool.c.
|
static |
Definition at line 810 of file test_taskpool.c.
|
static |
Definition at line 779 of file test_taskpool.c.
Referenced by load_module(), and unload_module().