mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 03:59:01 +00:00
stasis: Add statistics gathering in developer mode.
This change adds statistics gathering to Stasis topics, subscriptions, and message types. These can be viewed using CLI commands and provide insight into how Stasis is used and how long certain operations take to execute. These are only available when Asterisk is compiled in developer mode and do not have any impact under normal operation. ASTERISK-28117 Change-Id: I94411b53767f89ee01714daaecf0c2f1666e863f
This commit is contained in:
@@ -204,8 +204,14 @@ static void router_dispatch(void *data,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef AST_DEVMODE
|
||||
static struct stasis_message_router *stasis_message_router_create_internal(
|
||||
struct stasis_topic *topic, int use_thread_pool, const char *file, int lineno,
|
||||
const char *func)
|
||||
#else
|
||||
static struct stasis_message_router *stasis_message_router_create_internal(
|
||||
struct stasis_topic *topic, int use_thread_pool)
|
||||
#endif
|
||||
{
|
||||
int res;
|
||||
struct stasis_message_router *router;
|
||||
@@ -224,11 +230,20 @@ static struct stasis_message_router *stasis_message_router_create_internal(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef AST_DEVMODE
|
||||
if (use_thread_pool) {
|
||||
router->subscription = __stasis_subscribe_pool(topic, router_dispatch, router, file, lineno, func);
|
||||
} else {
|
||||
router->subscription = __stasis_subscribe(topic, router_dispatch, router, file, lineno, func);
|
||||
}
|
||||
#else
|
||||
if (use_thread_pool) {
|
||||
router->subscription = stasis_subscribe_pool(topic, router_dispatch, router);
|
||||
} else {
|
||||
router->subscription = stasis_subscribe(topic, router_dispatch, router);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!router->subscription) {
|
||||
ao2_ref(router, -1);
|
||||
|
||||
@@ -241,17 +256,33 @@ static struct stasis_message_router *stasis_message_router_create_internal(
|
||||
return router;
|
||||
}
|
||||
|
||||
#ifdef AST_DEVMODE
|
||||
struct stasis_message_router *__stasis_message_router_create(
|
||||
struct stasis_topic *topic, const char *file, int lineno, const char *func)
|
||||
{
|
||||
return stasis_message_router_create_internal(topic, 0, file, lineno, func);
|
||||
}
|
||||
#else
|
||||
struct stasis_message_router *stasis_message_router_create(
|
||||
struct stasis_topic *topic)
|
||||
{
|
||||
return stasis_message_router_create_internal(topic, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AST_DEVMODE
|
||||
struct stasis_message_router *__stasis_message_router_create_pool(
|
||||
struct stasis_topic *topic, const char *file, int lineno, const char *func)
|
||||
{
|
||||
return stasis_message_router_create_internal(topic, 1, file, lineno, func);
|
||||
}
|
||||
#else
|
||||
struct stasis_message_router *stasis_message_router_create_pool(
|
||||
struct stasis_topic *topic)
|
||||
{
|
||||
return stasis_message_router_create_internal(topic, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void stasis_message_router_unsubscribe(struct stasis_message_router *router)
|
||||
{
|
||||
|
Reference in New Issue
Block a user