Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
9bf25413
提交
9bf25413
authored
12月 02, 2011
作者:
James Zhang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'releases.3.4' of git.sangoma.com:smg_freeswitch into releases.3.4
上级
35df4f46
3432dccf
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
31 行增加
和
22 行删除
+31
-22
freetdm.conf
libs/freetdm/conf/freetdm.conf
+1
-1
ftdm_io.c
libs/freetdm/src/ftdm_io.c
+30
-21
没有找到文件。
libs/freetdm/conf/freetdm.conf
浏览文件 @
9bf25413
...
@@ -13,7 +13,7 @@ cpu_monitoring_interval => 1000
...
@@ -13,7 +13,7 @@ cpu_monitoring_interval => 1000
cpu_set_alarm_threshold
=>
80
cpu_set_alarm_threshold
=>
80
;
At
what
CPU
percentage
stop
the
CPU
alarm
;
At
what
CPU
percentage
stop
the
CPU
alarm
cpu_
reset
_alarm_threshold
=>
70
cpu_
clear
_alarm_threshold
=>
70
;
Which
action
to
take
when
the
CPU
alarm
is
raised
;
Which
action
to
take
when
the
CPU
alarm
is
raised
;
it
can
be
warn
and
/
or
reject
calls
;
it
can
be
warn
and
/
or
reject
calls
...
...
libs/freetdm/src/ftdm_io.c
浏览文件 @
9bf25413
...
@@ -223,7 +223,7 @@ typedef struct {
...
@@ -223,7 +223,7 @@ typedef struct {
uint32_t
interval
;
uint32_t
interval
;
uint8_t
alarm_action_flags
;
uint8_t
alarm_action_flags
;
uint8_t
set_alarm_threshold
;
uint8_t
set_alarm_threshold
;
uint8_t
reset
_alarm_threshold
;
uint8_t
clear
_alarm_threshold
;
ftdm_interrupt_t
*
interrupt
;
ftdm_interrupt_t
*
interrupt
;
}
cpu_monitor_t
;
}
cpu_monitor_t
;
...
@@ -4834,14 +4834,15 @@ static ftdm_status_t load_config(void)
...
@@ -4834,14 +4834,15 @@ static ftdm_status_t load_config(void)
}
else
{
}
else
{
ftdm_log
(
FTDM_LOG_ERROR
,
"Invalid cpu alarm set threshold %s
\n
"
,
val
);
ftdm_log
(
FTDM_LOG_ERROR
,
"Invalid cpu alarm set threshold %s
\n
"
,
val
);
}
}
}
else
if
(
!
strncasecmp
(
var
,
"cpu_reset_alarm_threshold"
,
sizeof
(
"cpu_reset_alarm_threshold"
)
-
1
))
{
}
else
if
(
!
strncasecmp
(
var
,
"cpu_reset_alarm_threshold"
,
sizeof
(
"cpu_reset_alarm_threshold"
)
-
1
)
||
!
strncasecmp
(
var
,
"cpu_clear_alarm_threshold"
,
sizeof
(
"cpu_clear_alarm_threshold"
)
-
1
))
{
intparam
=
atoi
(
val
);
intparam
=
atoi
(
val
);
if
(
intparam
>
0
&&
intparam
<
100
)
{
if
(
intparam
>
0
&&
intparam
<
100
)
{
globals
.
cpu_monitor
.
reset
_alarm_threshold
=
(
uint8_t
)
intparam
;
globals
.
cpu_monitor
.
clear
_alarm_threshold
=
(
uint8_t
)
intparam
;
if
(
globals
.
cpu_monitor
.
reset
_alarm_threshold
>
globals
.
cpu_monitor
.
set_alarm_threshold
)
{
if
(
globals
.
cpu_monitor
.
clear
_alarm_threshold
>
globals
.
cpu_monitor
.
set_alarm_threshold
)
{
globals
.
cpu_monitor
.
reset
_alarm_threshold
=
globals
.
cpu_monitor
.
set_alarm_threshold
-
10
;
globals
.
cpu_monitor
.
clear
_alarm_threshold
=
globals
.
cpu_monitor
.
set_alarm_threshold
-
10
;
ftdm_log
(
FTDM_LOG_ERROR
,
"Cpu alarm
reset threshold must be lower than set threshold
"
ftdm_log
(
FTDM_LOG_ERROR
,
"Cpu alarm
clear threshold must be lower than set threshold,
"
"
, setting threshold to %d
\n
"
,
globals
.
cpu_monitor
.
reset
_alarm_threshold
);
"
setting clear threshold to %d
\n
"
,
globals
.
cpu_monitor
.
clear
_alarm_threshold
);
}
}
}
else
{
}
else
{
ftdm_log
(
FTDM_LOG_ERROR
,
"Invalid cpu alarm reset threshold %s
\n
"
,
val
);
ftdm_log
(
FTDM_LOG_ERROR
,
"Invalid cpu alarm reset threshold %s
\n
"
,
val
);
...
@@ -5581,28 +5582,32 @@ static void *ftdm_cpu_monitor_run(ftdm_thread_t *me, void *obj)
...
@@ -5581,28 +5582,32 @@ static void *ftdm_cpu_monitor_run(ftdm_thread_t *me, void *obj)
{
{
cpu_monitor_t
*
monitor
=
(
cpu_monitor_t
*
)
obj
;
cpu_monitor_t
*
monitor
=
(
cpu_monitor_t
*
)
obj
;
struct
ftdm_cpu_monitor_stats
*
cpu_stats
=
ftdm_new_cpu_monitor
();
struct
ftdm_cpu_monitor_stats
*
cpu_stats
=
ftdm_new_cpu_monitor
();
ftdm_log
(
FTDM_LOG_DEBUG
,
"CPU monitor thread is now running
\n
"
);
if
(
!
cpu_stats
)
{
if
(
!
cpu_stats
)
{
return
NULL
;
goto
done
;
}
}
monitor
->
running
=
1
;
monitor
->
running
=
1
;
while
(
ftdm_running
())
{
while
(
ftdm_running
())
{
double
time
;
double
idle_time
=
0
.
0
;
if
(
ftdm_cpu_get_system_idle_time
(
cpu_stats
,
&
time
))
{
int
cpu_usage
=
0
;
if
(
ftdm_cpu_get_system_idle_time
(
cpu_stats
,
&
idle_time
))
{
break
;
break
;
}
}
cpu_usage
=
(
int
)(
100
-
idle_time
);
if
(
monitor
->
alarm
)
{
if
(
monitor
->
alarm
)
{
if
(
(
int
)
time
>=
(
100
-
monitor
->
set_alarm_threshold
)
)
{
if
(
cpu_usage
<=
monitor
->
clear_alarm_threshold
)
{
ftdm_log
(
FTDM_LOG_DEBUG
,
"CPU alarm
OFF (idle:%d)
\n
"
,
(
int
)
tim
e
);
ftdm_log
(
FTDM_LOG_DEBUG
,
"CPU alarm
is now OFF (cpu usage: %d)
\n
"
,
cpu_usag
e
);
monitor
->
alarm
=
0
;
monitor
->
alarm
=
0
;
}
}
else
if
(
monitor
->
alarm_action_flags
&
FTDM_CPU_ALARM_ACTION_WARN
)
{
if
(
monitor
->
alarm_action_flags
&
FTDM_CPU_ALARM_ACTION_WARN
)
{
ftdm_log
(
FTDM_LOG_WARNING
,
"CPU alarm is still ON (cpu usage: %d)
\n
"
,
cpu_usage
);
ftdm_log
(
FTDM_LOG_WARNING
,
"CPU alarm is ON (cpu usage:%d)
\n
"
,
(
int
)
(
100
-
time
));
}
}
}
else
{
}
else
{
if
(
(
int
)
time
<=
(
100
-
monitor
->
reset_alarm_threshold
)
)
{
if
(
cpu_usage
>=
monitor
->
set_alarm_threshold
)
{
ftdm_log
(
FTDM_LOG_
DEBUG
,
"CPU alarm ON (idle:%d)
\n
"
,
(
int
)
tim
e
);
ftdm_log
(
FTDM_LOG_
WARNING
,
"CPU alarm is now ON (cpu usage: %d)
\n
"
,
cpu_usag
e
);
monitor
->
alarm
=
1
;
monitor
->
alarm
=
1
;
}
}
}
}
...
@@ -5611,7 +5616,11 @@ static void *ftdm_cpu_monitor_run(ftdm_thread_t *me, void *obj)
...
@@ -5611,7 +5616,11 @@ static void *ftdm_cpu_monitor_run(ftdm_thread_t *me, void *obj)
ftdm_delete_cpu_monitor
(
cpu_stats
);
ftdm_delete_cpu_monitor
(
cpu_stats
);
monitor
->
running
=
0
;
monitor
->
running
=
0
;
done
:
ftdm_log
(
FTDM_LOG_DEBUG
,
"CPU monitor thread is now terminating
\n
"
);
return
NULL
;
return
NULL
;
#ifdef __WINDOWS__
#ifdef __WINDOWS__
UNREFERENCED_PARAMETER
(
me
);
UNREFERENCED_PARAMETER
(
me
);
#endif
#endif
...
@@ -5714,7 +5723,7 @@ FT_DECLARE(ftdm_status_t) ftdm_global_configuration(void)
...
@@ -5714,7 +5723,7 @@ FT_DECLARE(ftdm_status_t) ftdm_global_configuration(void)
globals
.
cpu_monitor
.
interval
=
1000
;
globals
.
cpu_monitor
.
interval
=
1000
;
globals
.
cpu_monitor
.
alarm_action_flags
=
0
;
globals
.
cpu_monitor
.
alarm_action_flags
=
0
;
globals
.
cpu_monitor
.
set_alarm_threshold
=
80
;
globals
.
cpu_monitor
.
set_alarm_threshold
=
80
;
globals
.
cpu_monitor
.
reset
_alarm_threshold
=
70
;
globals
.
cpu_monitor
.
clear
_alarm_threshold
=
70
;
if
(
load_config
()
!=
FTDM_SUCCESS
)
{
if
(
load_config
()
!=
FTDM_SUCCESS
)
{
globals
.
running
=
0
;
globals
.
running
=
0
;
...
@@ -5723,10 +5732,10 @@ FT_DECLARE(ftdm_status_t) ftdm_global_configuration(void)
...
@@ -5723,10 +5732,10 @@ FT_DECLARE(ftdm_status_t) ftdm_global_configuration(void)
}
}
if
(
globals
.
cpu_monitor
.
enabled
)
{
if
(
globals
.
cpu_monitor
.
enabled
)
{
ftdm_log
(
FTDM_LOG_INFO
,
"CPU Monitor is running interval:%d
lo-thres:%d hi
-thres:%d
\n
"
,
ftdm_log
(
FTDM_LOG_INFO
,
"CPU Monitor is running interval:%d
set-thres:%d clear
-thres:%d
\n
"
,
globals
.
cpu_monitor
.
interval
,
globals
.
cpu_monitor
.
interval
,
globals
.
cpu_monitor
.
set_alarm_threshold
,
globals
.
cpu_monitor
.
set_alarm_threshold
,
globals
.
cpu_monitor
.
reset
_alarm_threshold
);
globals
.
cpu_monitor
.
clear
_alarm_threshold
);
if
(
ftdm_cpu_monitor_start
()
!=
FTDM_SUCCESS
)
{
if
(
ftdm_cpu_monitor_start
()
!=
FTDM_SUCCESS
)
{
return
FTDM_FAIL
;
return
FTDM_FAIL
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论