Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-07-27 17:46:31 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4f4b15f500aad44d51a191b1eaf81f92323b1429
4f4b15f5
1 parent
ef7a02e6
refine the disk iops stat, get cpu info.
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
9 行增加
和
7 行删除
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_utility.cpp
trunk/src/app/srs_app_utility.hpp
trunk/src/app/srs_app_server.cpp
查看文件 @
4f4b15f
...
...
@@ -74,9 +74,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// update the disk iops interval:
// SRS_SYS_CYCLE_INTERVAL * SRS_SYS_DISK_STAT_RESOLUTION_TIMES
// @remark, depends on SRS_SYS_CPU_STAT_RESOLUTION_TIMES, for the disk util
// depends on cpu time, so the disk stat times must be times of cpu stat time.
// for example, when cpu is 30, disk must be 30*1 or 30*2 ..., 30*N is ok.
#define SRS_SYS_DISK_STAT_RESOLUTION_TIMES 60
// update rusage interval:
...
...
trunk/src/app/srs_app_utility.cpp
查看文件 @
4f4b15f
...
...
@@ -490,6 +490,9 @@ void srs_update_disk_stat()
if
(
!
srs_get_disk_diskstats_stat
(
r
))
{
return
;
}
if
(
!
get_proc_system_stat
(
r
.
cpu
))
{
return
;
}
SrsDiskStat
&
o
=
_srs_disk_stat
;
if
(
!
o
.
ok
)
{
...
...
@@ -513,16 +516,16 @@ void srs_update_disk_stat()
}
// diskstats
if
(
true
)
{
SrsProcSystemStat
*
cpu
=
srs_get_system_proc_stat
();
if
(
r
.
cpu
.
ok
&&
o
.
cpu
.
ok
)
{
SrsCpuInfo
*
cpuinfo
=
srs_get_cpuinfo
();
r
.
cpu
.
total_delta
=
r
.
cpu
.
total
()
-
o
.
cpu
.
total
();
if
(
cpu
->
ok
&&
cpu
->
total_delta
>
0
if
(
r
.
cpu
.
ok
&&
r
.
cpu
.
total_delta
>
0
&&
cpuinfo
->
ok
&&
cpuinfo
->
nb_processors
>
0
&&
o
.
ticks
<
r
.
ticks
)
{
// @see: print_partition_stats() of iostat.c
double
delta_ms
=
cpu
->
total_delta
*
10
/
cpuinfo
->
nb_processors
;
double
delta_ms
=
r
.
cpu
.
total_delta
*
10
/
cpuinfo
->
nb_processors
;
unsigned
int
ticks
=
r
.
ticks
-
o
.
ticks
;
// busy in [0, 1], where 0.1532 means 15.32%
...
...
trunk/src/app/srs_app_utility.hpp
查看文件 @
4f4b15f
...
...
@@ -341,6 +341,8 @@ public:
// @see: print_partition_stats() of iostat.c
// but its value is [0, +], for instance, 0.1532 means 15.32%.
float
busy
;
// for stat the busy%
SrsProcSystemStat
cpu
;
public
:
// @see: cat /proc/vmstat
...
...
请
注册
或
登录
后发表评论