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 15:43:43 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f53bfcea5436c9a78ce59322b485925f1d04ed2d
f53bfcea
1 parent
abef0296
add udp stat to nb_conn_sys as nb_conn_sys_udp
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
91 行增加
和
5 行删除
trunk/src/app/srs_app_utility.cpp
trunk/src/app/srs_app_utility.hpp
trunk/src/app/srs_app_utility.cpp
查看文件 @
f53bfce
...
...
@@ -680,6 +680,7 @@ SrsNetworkRtmpServer::SrsNetworkRtmpServer()
sample_time
=
rbytes
=
sbytes
=
0
;
nb_conn_sys
=
nb_conn_srs
=
0
;
nb_conn_sys_et
=
nb_conn_sys_tw
=
nb_conn_sys_ls
=
0
;
nb_conn_sys_udp
=
0
;
}
static
SrsNetworkRtmpServer
_srs_network_rtmp_server
;
...
...
@@ -710,6 +711,9 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
{
SrsNetworkRtmpServer
&
r
=
_srs_network_rtmp_server
;
// reset total.
r
.
nb_conn_sys
=
0
;
if
(
true
)
{
FILE
*
f
=
fopen
(
"/proc/net/tcp"
,
"r"
);
if
(
f
==
NULL
)
{
...
...
@@ -725,12 +729,11 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
int
nb_conn_sys_time_wait
=
0
;
int
nb_conn_sys_listen
=
0
;
int
nb_conn_sys_other
=
0
;
for
(;;)
{
int
st
=
0
;
int
ret
=
fscanf
(
f
,
"%*s %*s %*s %2x
\n
"
,
&
st
);
// ignore to end.
fgets
(
buf
,
sizeof
(
buf
),
f
);
// @see: http://tester-higkoo.googlecode.com/svn-history/r14/trunk/Tools/iostat/iostat.c
while
(
fgets
(
buf
,
sizeof
(
buf
),
f
))
{
int
st
=
0
;
int
ret
=
sscanf
(
buf
,
"%*s %*s %*s %2x
\n
"
,
&
st
);
if
(
ret
==
1
)
{
if
(
st
==
SYS_TCP_ESTABLISHED
)
{
...
...
@@ -758,6 +761,38 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
}
if
(
true
)
{
FILE
*
f
=
fopen
(
"/proc/net/udp"
,
"r"
);
if
(
f
==
NULL
)
{
srs_warn
(
"open proc network udp failed, ignore"
);
return
;
}
// ignore title.
static
char
buf
[
1024
];
fgets
(
buf
,
sizeof
(
buf
),
f
);
// all udp is close state.
int
nb_conn_sys_close
=
0
;
// @see: http://tester-higkoo.googlecode.com/svn-history/r14/trunk/Tools/iostat/iostat.c
while
(
fgets
(
buf
,
sizeof
(
buf
),
f
))
{
int
st
=
0
;
int
ret
=
sscanf
(
buf
,
"%*s %*s %*s %2x
\n
"
,
&
st
);
if
(
ret
==
EOF
)
{
break
;
}
nb_conn_sys_close
++
;
}
r
.
nb_conn_sys
+=
nb_conn_sys_close
;
r
.
nb_conn_sys_udp
=
nb_conn_sys_close
;
fclose
(
f
);
}
if
(
true
)
{
r
.
ok
=
true
;
r
.
nb_conn_srs
=
nb_conn
;
...
...
@@ -973,6 +1008,7 @@ void srs_api_dump_summaries(std::stringstream& ss)
<<
__SRS_JFIELD_ORG
(
"conn_sys_et"
,
nrs
->
nb_conn_sys_et
)
<<
__SRS_JFIELD_CONT
<<
__SRS_JFIELD_ORG
(
"conn_sys_tw"
,
nrs
->
nb_conn_sys_tw
)
<<
__SRS_JFIELD_CONT
<<
__SRS_JFIELD_ORG
(
"conn_sys_ls"
,
nrs
->
nb_conn_sys_ls
)
<<
__SRS_JFIELD_CONT
<<
__SRS_JFIELD_ORG
(
"conn_sys_udp"
,
nrs
->
nb_conn_sys_udp
)
<<
__SRS_JFIELD_CONT
<<
__SRS_JFIELD_ORG
(
"conn_srs"
,
nrs
->
nb_conn_srs
)
<<
__SRS_JOBJECT_END
<<
__SRS_JOBJECT_END
...
...
trunk/src/app/srs_app_utility.hpp
查看文件 @
f53bfce
...
...
@@ -350,6 +350,55 @@ public:
unsigned
long
pgpgout
;
// @see: https://www.kernel.org/doc/Documentation/iostats.txt
// @see: cat /proc/diskstats
//
// Number of issued reads.
// This is the total number of reads completed successfully.
unsigned
long
long
nb_read
;
// Number of reads merged
unsigned
long
long
nb_mread
;
// Number of sectors read.
// This is the total number of sectors read successfully.
unsigned
long
long
nb_sread
;
// Number of milliseconds spent reading.
// This is the total number of milliseconds spent by all reads
// (as measured from __make_request() to end_that_request_last()).
unsigned
long
long
ms_read
;
//
// Number of writes completed.
// This is the total number of writes completed successfully
unsigned
long
long
nb_write
;
// Number of writes merged Reads and writes which are adjacent
// to each other may be merged for efficiency. Thus two 4K
// reads may become one 8K read before it is ultimately
// handed to the disk, and so it will be counted (and queued)
// as only one I/O. This field lets you know how often this was done.
unsigned
long
long
nb_mwrite
;
// Number of sectors written.
// This is the total number of sectors written successfully.
unsigned
long
long
nb_swrite
;
// Number of milliseconds spent writing .
// This is the total number of milliseconds spent by all writes
// (as measured from __make_request() to end_that_request_last()).
unsigned
long
long
ms_write
;
//
// Number of I/Os currently in progress.
// The only field that should go to zero.
// Incremented as requests are given to appropriate request_queue_t
// and decremented as they finish.
unsigned
long
long
nb_current
;
// Number of milliseconds spent doing I/Os.
// This field is increased so long as field 9 is nonzero.
unsigned
long
long
ms_total
;
// Number of milliseconds spent doing I/Os.
// This field is incremented at each I/O start, I/O completion,
// I/O merge, or read of these stats by the number of I/Os in
// progress (field 9) times the number of milliseconds spent
// doing I/O since the last update of this field. This can
// provide an easy measure of both I/O completion time and
// the backlog that may be accumulating.
// weighting total.
unsigned
long
long
ms_wtotal
;
public
:
SrsDiskStat
();
...
...
@@ -529,6 +578,7 @@ public:
int
nb_conn_sys_et
;
// established
int
nb_conn_sys_tw
;
// time wait
int
nb_conn_sys_ls
;
// listen
int
nb_conn_sys_udp
;
// udp
int
nb_conn_srs
;
public
:
...
...
请
注册
或
登录
后发表评论