From 7256caf2784e6fa07f61a2e8fe4e0c8db27ae0a4 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sat, 16 Nov 2013 14:17:41 +0800 Subject: [PATCH] add a debug_pool param to fsctl --- src/include/switch_core.h | 1 + src/mod/applications/mod_commands/mod_commands.c | 4 ++++ src/switch_core_session.c | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 40f58ef26c..e2c5749e7d 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2601,6 +2601,7 @@ SWITCH_DECLARE(int) switch_stream_system_fork(const char *cmd, switch_stream_han SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t *stream); SWITCH_DECLARE(switch_call_direction_t) switch_ice_direction(switch_core_session_t *session); +SWITCH_DECLARE(void) switch_core_session_debug_pool(switch_stream_handle_t *stream); SWITCH_END_EXTERN_C #endif diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 4a3153de5a..4ae58d2212 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2276,6 +2276,9 @@ SWITCH_STANDARD_API(ctl_function) switch_core_session_ctl(command, &arg); stream->write_function(stream, "+OK\n"); + } else if (!strcasecmp(argv[0], "debug_pool")) { + switch_core_session_debug_pool(stream); + } else if (!strcasecmp(argv[0], "debug_sql")) { int x = 0; switch_core_session_ctl(SCSC_DEBUG_SQL, &x); @@ -6535,6 +6538,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add complete del"); switch_console_set_complete("add db_cache status"); switch_console_set_complete("add fsctl debug_level"); + switch_console_set_complete("add fsctl debug_pool"); switch_console_set_complete("add fsctl debug_sql"); switch_console_set_complete("add fsctl last_sps"); switch_console_set_complete("add fsctl default_dtmf_duration"); diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 63aab9d583..0056e2d155 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -37,6 +37,8 @@ #include "switch_core.h" #include "private/switch_core_pvt.h" +#define DEBUG_THREAD_POOL + struct switch_session_manager session_manager; SWITCH_DECLARE(void) switch_core_session_set_dmachine(switch_core_session_t *session, switch_ivr_dmachine_t *dmachine, switch_digit_action_target_t target) @@ -2984,6 +2986,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_refresh_video(switch_core_se return SWITCH_STATUS_FALSE; } +SWITCH_DECLARE(void) switch_core_session_debug_pool(switch_stream_handle_t *stream) +{ + stream->write_function(stream, "Thread pool: running:%d busy:%d popping:%d\n", + session_manager.running, session_manager.busy, session_manager.popping); +} /* For Emacs: * Local Variables: