Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d655ceec
提交
d655ceec
authored
4月 02, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add fsctl debug sql
上级
b80a3a34
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
39 行增加
和
19 行删除
+39
-19
switch_types.h
src/include/switch_types.h
+4
-2
mod_commands.c
src/mod/applications/mod_commands/mod_commands.c
+7
-0
switch_core.c
src/switch_core.c
+11
-0
switch_core_sqldb.c
src/switch_core_sqldb.c
+17
-17
没有找到文件。
src/include/switch_types.h
浏览文件 @
d655ceec
...
...
@@ -314,7 +314,8 @@ typedef enum {
SCF_CLEAR_SQL
=
(
1
<<
17
),
SCF_THREADED_SYSTEM_EXEC
=
(
1
<<
18
),
SCF_SYNC_CLOCK_REQUESTED
=
(
1
<<
19
),
SCF_CORE_ODBC_REQ
=
(
1
<<
20
)
SCF_CORE_ODBC_REQ
=
(
1
<<
20
),
SCF_DEBUG_SQL
=
(
1
<<
21
)
}
switch_core_flag_enum_t
;
typedef
uint32_t
switch_core_flag_t
;
...
...
@@ -1743,7 +1744,8 @@ typedef enum {
SCSC_PAUSE_CHECK
,
SCSC_READY_CHECK
,
SCSC_THREADED_SYSTEM_EXEC
,
SCSC_SYNC_CLOCK_WHEN_IDLE
SCSC_SYNC_CLOCK_WHEN_IDLE
,
SCSC_DEBUG_SQL
,
}
switch_session_ctl_t
;
typedef
enum
{
...
...
src/mod/applications/mod_commands/mod_commands.c
浏览文件 @
d655ceec
...
...
@@ -1908,6 +1908,12 @@ SWITCH_STANDARD_API(ctl_function)
}
switch_core_session_ctl
(
command
,
&
arg
);
stream
->
write_function
(
stream
,
"+OK
\n
"
);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"debug_sql"
))
{
int
x
=
0
;
switch_core_session_ctl
(
SCSC_DEBUG_SQL
,
&
x
);
stream
->
write_function
(
stream
,
"+OK SQL DEBUG [%s]
\n
"
,
x
?
"on"
:
"off"
);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"reclaim_mem"
))
{
switch_core_session_ctl
(
SCSC_RECLAIM
,
&
arg
);
stream
->
write_function
(
stream
,
"+OK
\n
"
);
...
...
@@ -5461,6 +5467,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_sql"
);
switch_console_set_complete
(
"add fsctl last_sps"
);
switch_console_set_complete
(
"add fsctl default_dtmf_duration"
);
switch_console_set_complete
(
"add fsctl hupall"
);
...
...
src/switch_core.c
浏览文件 @
d655ceec
...
...
@@ -2014,6 +2014,17 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
}
switch
(
cmd
)
{
case
SCSC_DEBUG_SQL
:
{
if
(
switch_test_flag
((
&
runtime
),
SCF_DEBUG_SQL
))
{
switch_clear_flag
((
&
runtime
),
SCF_DEBUG_SQL
);
newintval
=
0
;
}
else
{
switch_set_flag
((
&
runtime
),
SCF_DEBUG_SQL
);
newintval
=
1
;
}
}
break
;
case
SCSC_VERBOSE_EVENTS
:
if
(
intval
)
{
if
(
oldintval
>
-
1
)
{
...
...
src/switch_core_sqldb.c
浏览文件 @
d655ceec
...
...
@@ -34,7 +34,7 @@
#include <switch.h>
#include "private/switch_core_pvt.h"
//#define DEBUG_SQL 1
#define SWITCH_SQL_QUEUE_LEN 100000
#define SWITCH_SQL_QUEUE_PAUSE_LEN 90000
...
...
@@ -1019,11 +1019,11 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread,
if
(
new_mlen
<
runtime
.
max_sql_buffer_len
)
{
sql_len
=
new_mlen
;
#ifdef DEBUG_SQL
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"REALLOC %ld %d %d
\n
"
,
(
long
int
)
sql_len
,
switch_queue_size
(
sql_manager
.
sql_queue
[
0
]),
switch_queue_size
(
sql_manager
.
sql_queue
[
1
]));
#endif
if
(
switch_test_flag
((
&
runtime
),
SCF_DEBUG_SQL
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"REALLOC %ld %d %d
\n
"
,
(
long
int
)
sql_len
,
switch_queue_size
(
sql_manager
.
sql_queue
[
0
]),
switch_queue_size
(
sql_manager
.
sql_queue
[
1
]));
}
if
(
!
(
tmp
=
realloc
(
sqlbuf
,
sql_len
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"SQL thread ending on mem err
\n
"
);
abort
();
...
...
@@ -1031,10 +1031,10 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread,
}
sqlbuf
=
tmp
;
}
else
{
#ifdef DEBUG_SQL
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"SAVE %d %d
\n
"
,
switch_queue_size
(
sql_manager
.
sql_queue
[
0
]),
switch_queue_size
(
sql_manager
.
sql_queue
[
1
]));
#endif
if
(
switch_test_flag
((
&
runtime
),
SCF_DEBUG_SQL
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"SAVE %d %d
\n
"
,
switch_queue_size
(
sql_manager
.
sql_queue
[
0
]),
switch_queue_size
(
sql_manager
.
sql_queue
[
1
]));
}
save_sql
=
sql
;
sql
=
NULL
;
lc
=
0
;
...
...
@@ -1077,16 +1077,16 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread,
wrote
=
0
;
if
(
trans
&&
iterations
&&
(
iterations
>
target
||
!
lc
))
{
#ifdef DEBUG_SQL
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"RUN %d %d %d
\n
"
,
switch_queue_size
(
sql_manager
.
sql_queue
[
0
]),
switch_queue_size
(
sql_manager
.
sql_queue
[
1
]),
iterations
);
#endif
if
(
switch_test_flag
((
&
runtime
),
SCF_DEBUG_SQL
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"RUN %d %d %d
\n
"
,
switch_queue_size
(
sql_manager
.
sql_queue
[
0
]),
switch_queue_size
(
sql_manager
.
sql_queue
[
1
]),
iterations
);
}
if
(
switch_cache_db_persistant_execute_trans
(
sql_manager
.
event_db
,
sqlbuf
,
1
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"SQL thread unable to commit transaction, records lost!
\n
"
);
}
#ifdef DEBUG_SQL
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"DONE
\n
"
);
#endif
if
(
switch_test_flag
((
&
runtime
),
SCF_DEBUG_SQL
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"DONE
\n
"
);
}
iterations
=
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论