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
2015-03-19 10:17:51 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
b7138ba9c5ffa7c618f78f0a319e568b9aa56fd0
b7138ba9
2 parents
4a50bf18
e319da33
merge from 2.0
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
45 行增加
和
2 行删除
trunk/src/app/srs_app_http_conn.cpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_utility.cpp
trunk/src/app/srs_app_http_conn.cpp
查看文件 @
b7138ba
...
...
@@ -285,7 +285,7 @@ int SrsStreamCache::cycle()
if
(
pprint
->
can_print
())
{
srs_trace
(
"-> "
SRS_CONSTS_LOG_HTTP_STREAM_CACHE
" http: got %d msgs, age=%d, min=%d, mw=%d"
,
pprint
->
age
(),
count
,
SRS_PERF_MW_MIN_MSGS
,
SRS_CONSTS_RTMP_PULSE_TIMEOUT_US
/
1000
);
count
,
pprint
->
age
()
,
SRS_PERF_MW_MIN_MSGS
,
SRS_CONSTS_RTMP_PULSE_TIMEOUT_US
/
1000
);
}
// free the messages.
...
...
@@ -644,7 +644,7 @@ int SrsLiveStream::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
if
(
pprint
->
can_print
())
{
srs_info
(
"-> "
SRS_CONSTS_LOG_HTTP_STREAM
" http: got %d msgs, age=%d, min=%d, mw=%d"
,
pprint
->
age
(),
count
,
SRS_PERF_MW_MIN_MSGS
,
SRS_CONSTS_RTMP_PULSE_TIMEOUT_US
/
1000
);
count
,
pprint
->
age
()
,
SRS_PERF_MW_MIN_MSGS
,
SRS_CONSTS_RTMP_PULSE_TIMEOUT_US
/
1000
);
}
// sendout all messages.
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
b7138ba
...
...
@@ -849,10 +849,12 @@ int SrsServer::do_cycle()
srs_info
(
"update memory info, usage/free."
);
srs_update_meminfo
();
}
#endif
if
((
i
%
SRS_SYS_PLATFORM_INFO_RESOLUTION_TIMES
)
==
0
)
{
srs_info
(
"update platform info, uptime/load."
);
srs_update_platform_info
();
}
#ifndef SRS_OSX
if
((
i
%
SRS_SYS_NETWORK_DEVICE_RESOLUTION_TIMES
)
==
0
)
{
srs_info
(
"update network devices info."
);
srs_update_network_devices
();
...
...
trunk/src/app/srs_app_utility.cpp
查看文件 @
b7138ba
...
...
@@ -28,6 +28,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <ifaddrs.h>
#include <arpa/inet.h>
#ifdef SRS_OSX
#include <sys/sysctl.h>
#endif
using
namespace
std
;
#include <srs_kernel_log.hpp>
...
...
@@ -666,6 +669,7 @@ void srs_update_platform_info()
r
.
srs_startup_time
=
srs_get_system_startup_time_ms
();
#ifndef SRS_OSX
if
(
true
)
{
FILE
*
f
=
fopen
(
"/proc/uptime"
,
"r"
);
if
(
f
==
NULL
)
{
...
...
@@ -694,6 +698,43 @@ void srs_update_platform_info()
fclose
(
f
);
}
#else
// man 3 sysctl
if
(
true
)
{
struct
timeval
tv
;
size_t
len
=
sizeof
(
timeval
);
int
mib
[
2
];
mib
[
0
]
=
CTL_KERN
;
mib
[
1
]
=
KERN_BOOTTIME
;
if
(
sysctl
(
mib
,
2
,
&
tv
,
&
len
,
NULL
,
0
)
<
0
)
{
srs_warn
(
"sysctl boottime failed, ignore"
);
return
;
}
time_t
bsec
=
tv
.
tv_sec
;
time_t
csec
=
::
time
(
NULL
);
r
.
os_uptime
=
difftime
(
csec
,
bsec
);
}
// man 3 sysctl
if
(
true
)
{
struct
loadavg
la
;
size_t
len
=
sizeof
(
loadavg
);
int
mib
[
2
];
mib
[
0
]
=
CTL_VM
;
mib
[
1
]
=
VM_LOADAVG
;
if
(
sysctl
(
mib
,
2
,
&
la
,
&
len
,
NULL
,
0
)
<
0
)
{
srs_warn
(
"sysctl loadavg failed, ignore"
);
return
;
}
r
.
load_one_minutes
=
(
double
)
la
.
ldavg
[
0
]
/
la
.
fscale
;
r
.
load_five_minutes
=
(
double
)
la
.
ldavg
[
1
]
/
la
.
fscale
;
r
.
load_fifteen_minutes
=
(
double
)
la
.
ldavg
[
2
]
/
la
.
fscale
;
}
#endif
r
.
ok
=
true
;
}
...
...
请
注册
或
登录
后发表评论