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-03-07 12:24:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
741d6f97f68451a629bdf9a9961f0477d4f6394c
741d6f97
1 parent
489a492e
support gperf memory check(gmc).
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
88 行增加
和
24 行删除
trunk/auto/depends.sh
trunk/auto/options.sh
trunk/configure
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_server.hpp
trunk/src/main/srs_main_server.cpp
trunk/auto/depends.sh
查看文件 @
741d6f9
...
...
@@ -451,12 +451,21 @@ fi
if
[
$SRS_GPERF
=
YES
]
;
then
echo
"#define SRS_GPERF"
>>
$SRS_AUTO_HEADERS_H
#echo "#define SRS_GPERF_CPU_PROFILE" >> $SRS_AUTO_HEADERS_H
#echo "#define SRS_GPERF_HEAP_PROFILE" >> $SRS_AUTO_HEADERS_H
echo
"#define SRS_GPERF_HEAP_CHECK"
>>
$SRS_AUTO_HEADERS_H
else
echo
"#undef SRS_GPERF"
>>
$SRS_AUTO_HEADERS_H
echo
"#undef SRS_GPERF_CPU_PROFILE"
>>
$SRS_AUTO_HEADERS_H
echo
"#undef SRS_GPERF_HEAP_PROFILE"
>>
$SRS_AUTO_HEADERS_H
echo
"#undef SRS_GPERF_HEAP_CHECK"
>>
$SRS_AUTO_HEADERS_H
fi
if
[
$SRS_GPERF_MC
=
YES
]
;
then
echo
"#define SRS_GPERF_MC"
>>
$SRS_AUTO_HEADERS_H
else
echo
"#undef SRS_GPERF_MC"
>>
$SRS_AUTO_HEADERS_H
fi
if
[
$SRS_GPERF_MP
=
YES
]
;
then
echo
"#define SRS_GPERF_MP"
>>
$SRS_AUTO_HEADERS_H
else
echo
"#undef SRS_GPERF_MP"
>>
$SRS_AUTO_HEADERS_H
fi
if
[
$SRS_GPERF_CP
=
YES
]
;
then
echo
"#define SRS_GPERF_CP"
>>
$SRS_AUTO_HEADERS_H
else
echo
"#undef SRS_GPERF_CP"
>>
$SRS_AUTO_HEADERS_H
fi
...
...
trunk/auto/options.sh
查看文件 @
741d6f9
...
...
@@ -18,6 +18,9 @@ SRS_HTTP=RESERVED
SRS_RESEARCH
=
RESERVED
SRS_UTEST
=
RESERVED
SRS_GPERF
=
RESERVED
SRS_GPERF_MC
=
RESERVED
SRS_GPERF_MP
=
RESERVED
SRS_GPERF_CP
=
RESERVED
# arguments
SRS_JOBS
=
1
...
...
@@ -28,7 +31,9 @@ SRS_FFMPEG=YES
SRS_HTTP
=
YES
SRS_RESEARCH
=
NO
SRS_UTEST
=
YES
SRS_GPERF
=
NO
SRS_GPERF_MC
=
NO
SRS_GPERF_MP
=
NO
SRS_GPERF_CP
=
NO
#####################################################################################
# parse options
...
...
@@ -56,7 +61,9 @@ do
--with-http
)
SRS_HTTP
=
YES
;;
--with-research
)
SRS_RESEARCH
=
YES
;;
--with-utest
)
SRS_UTEST
=
YES
;;
--with-gperf
)
SRS_GPERF
=
YES
;;
--with-gmc
)
SRS_GPERF_MC
=
YES
;;
--with-gmp
)
SRS_GPERF_MP
=
YES
;;
--with-gcp
)
SRS_GPERF_CP
=
YES
;;
--without-ssl
)
SRS_SSL
=
NO
;;
--without-hls
)
SRS_HLS
=
NO
;;
...
...
@@ -64,7 +71,9 @@ do
--without-http
)
SRS_HTTP
=
NO
;;
--without-research
)
SRS_RESEARCH
=
NO
;;
--without-utest
)
SRS_UTEST
=
NO
;;
--without-gperf
)
SRS_GPERF
=
NO
;;
--without-gmc
)
SRS_GPERF_MC
=
NO
;;
--without-gmp
)
SRS_GPERF_MP
=
NO
;;
--without-gcp
)
SRS_GPERF_CP
=
NO
;;
--jobs
)
SRS_JOBS
=
${
value
}
;;
...
...
@@ -101,7 +110,7 @@ if [ $help = yes ]; then
--with-ffmpeg enable transcoding with ffmpeg.
--with-research build the research tools.
--with-utest build the utest for srs.
--with-g
perf build
srs with gperf tools.
--with-g
mc build memory check for
srs with gperf tools.
--without-ssl disable rtmp complex handshake.
--without-hls disable hls, rtmp streaming only.
...
...
@@ -109,7 +118,7 @@ if [ $help = yes ]; then
--without-ffmpeg disable the ffmpeg transcoding feature.
--without-research do not build the research tools.
--without-utest do not build the utest for srs.
--without-g
perf do not build
srs with gperf tools.
--without-g
mc do not build memory check for
srs with gperf tools.
--jobs[=N] Allow N jobs at once; infinite jobs with no arg.
used for make in the configure, for example, to make ffmpeg.
...
...
@@ -146,10 +155,29 @@ if [ $SRS_UTEST = RESERVED ]; then
echo
"you must specifies the utest, see: ./configure --help"
;
__check_ok
=
NO
fi
if
[
$SRS_GPERF
=
RESERVED
]
;
then
echo
"you must specifies the gperf, see: ./configure --help"
;
if
[
$SRS_GPERF_MC
=
RESERVED
]
;
then
echo
"you must specifies the gperf-mc, see: ./configure --help"
;
__check_ok
=
NO
fi
if
[
$SRS_GPERF_MP
=
RESERVED
]
;
then
echo
"you must specifies the gperf-mp, see: ./configure --help"
;
__check_ok
=
NO
fi
if
[
$SRS_GPERF_CP
=
RESERVED
]
;
then
echo
"you must specifies the gperf-cp, see: ./configure --help"
;
__check_ok
=
NO
fi
if
[
$__check_ok
=
NO
]
;
then
exit
1;
fi
# generate the group option: SRS_GPERF
if
[
$SRS_GPERF_MC
=
YES
]
;
then
SRS_GPERF
=
YES
fi
if
[
$SRS_GPERF_MP
=
YES
]
;
then
SRS_GPERF
=
YES
fi
if
[
$SRS_GPERF_CP
=
YES
]
;
then
SRS_GPERF
=
YES
fi
...
...
trunk/configure
查看文件 @
741d6f9
...
...
@@ -64,6 +64,8 @@ SrsFfmpegSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_FFMPEG = YES ]; then Sr
SrsHttpSummaryColor
=
"
\$
(YELLOW)(disabled) "
;
if
[
$SRS_HTTP
=
YES
]
;
then
SrsHttpSummaryColor
=
"
\$
(GREEN)"
;
fi
SrsResearchSummaryColor
=
"
\$
(YELLOW)(disabled) "
;
if
[
$SRS_RESEARCH
=
YES
]
;
then
SrsResearchSummaryColor
=
"
\$
(GREEN)"
;
fi
SrsUtestSummaryColor
=
"
\$
(YELLOW)(disabled) "
;
if
[
$SRS_UTEST
=
YES
]
;
then
SrsUtestSummaryColor
=
"
\$
(GREEN)"
;
fi
SrsGperfSummaryColor
=
"
\$
(YELLOW)(disabled) "
;
if
[
$SRS_GPERF
=
YES
]
;
then
SrsGperfSummaryColor
=
"
\$
(GREEN)"
;
fi
SrsGperfMCSummaryColor
=
"
\$
(YELLOW)(disabled) "
;
if
[
$SRS_GPERF_MC
=
YES
]
;
then
SrsGperfMCSummaryColor
=
"
\$
(GREEN)"
;
fi
#####################################################################################
# makefile
...
...
@@ -91,6 +93,10 @@ default: bandwidth librtmp-sample utest
@echo -e " \$(GREEN)librtmp-sample: ./research/librtmp, the srs-librtmp client sample\$(BLACK)"
@echo -e " ${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info.\$(BLACK)"
@echo -e " ${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\$(BLACK)"
@echo -e " ${SrsGperfSummaryColor}gperf: gmc/gmp/gcp for srs, @see: \$(BLACK)"
@echo -e " ${SrsGperfMCSummaryColor}gmc: gperf memory check, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\$(BLACK)"
@echo -e " ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)"
@echo -e " ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)"
@echo -e "\$(GREEN)binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build\$(BLACK)"
help:
...
...
@@ -313,10 +319,20 @@ if [ $SRS_UTEST = YES ]; then
else
echo
-e
"
${
YELLOW
}
note: utest for srs are not builded
${
BLACK
}
"
fi
if
[
$SRS_GPERF
=
YES
]
;
then
echo
-e
"
${
GREEN
}
gperf(mem leak detect, mem/cpu perf) for srs are builded
${
BLACK
}
"
if
[
$SRS_GPERF_MC
=
YES
]
;
then
echo
-e
"
${
GREEN
}
gmc(gperf memory check) for srs are builded
${
BLACK
}
"
else
echo
-e
"
${
YELLOW
}
note: gperf(mem leak detect, mem/cpu perf) for srs are not builded
${
BLACK
}
"
echo
-e
"
${
YELLOW
}
note: gmc(gperf memory check) for srs are not builded
${
BLACK
}
"
fi
if
[
$SRS_GPERF_MP
=
YES
]
;
then
echo
-e
"
${
GREEN
}
gmp(gperf memory profile) for srs are builded
${
BLACK
}
"
else
echo
-e
"
${
YELLOW
}
note: gmp(gperf memory profile) for srs are not builded
${
BLACK
}
"
fi
if
[
$SRS_GPERF_CP
=
YES
]
;
then
echo
-e
"
${
GREEN
}
gcp(gperf cpu profile) for srs are builded
${
BLACK
}
"
else
echo
-e
"
${
YELLOW
}
note: gcp(gperf cpu profile) for srs are not builded
${
BLACK
}
"
fi
#####################################################################################
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
741d6f9
...
...
@@ -150,6 +150,7 @@ int SrsListener::cycle()
SrsServer
::
SrsServer
()
{
signal_reload
=
false
;
signal_gmc_stop
=
false
;
srs_assert
(
_srs_config
);
_srs_config
->
subscribe
(
this
);
...
...
@@ -232,15 +233,18 @@ int SrsServer::cycle()
st_usleep
(
SRS_TIME_RESOLUTION_MS
*
1000
);
srs_update_system_time_ms
();
if
(
signal_reload
)
{
// for gperf heap checker,
// @see: research/gperftools/heap-checker/heap_checker.cc
// if user interrupt the program, exit to check mem leak.
// but, if gperf, use reload to terminate the server,
// for the SIGINT will cause core-dump.
#ifdef SRS_GPERF
// but, if gperf, use reload to ensure main return normally,
// because directly exit will cause core-dump.
#ifdef SRS_GPERF_MC
if
(
signal_gmc_stop
)
{
break
;
}
#endif
if
(
signal_reload
)
{
signal_reload
=
false
;
srs_info
(
"get signal reload, to reload the config."
);
...
...
@@ -274,7 +278,16 @@ void SrsServer::on_signal(int signo)
{
if
(
signo
==
SIGNAL_RELOAD
)
{
signal_reload
=
true
;
return
;
}
#ifdef SRS_GPERF_MC
if
(
signo
==
SIGINT
)
{
srs_trace
(
"gmc is on, main cycle will terminate normally."
);
signal_gmc_stop
=
true
;
return
;
}
#endif
// TODO: handle the SIGINT, SIGTERM.
}
...
...
trunk/src/app/srs_app_server.hpp
查看文件 @
741d6f9
...
...
@@ -73,6 +73,7 @@ private:
std
::
vector
<
SrsConnection
*>
conns
;
std
::
vector
<
SrsListener
*>
listeners
;
bool
signal_reload
;
bool
signal_gmc_stop
;
public
:
SrsServer
();
virtual
~
SrsServer
();
...
...
trunk/src/main/srs_main_server.cpp
查看文件 @
741d6f9
...
...
@@ -53,10 +53,6 @@ void handler(int signo)
int
main
(
int
argc
,
char
**
argv
)
{
int
ret
=
ERROR_SUCCESS
;
#ifdef SRS_GPERF_HEAP_CHECK
// env HEAPCHECK=normal ./objs/srs -c srs.conf
#endif
#ifdef SRS_GPERF_HEAP_PROFILE
HeapProfilerStart
(
"gperf.srs"
);
...
...
@@ -66,6 +62,7 @@ int main(int argc, char** argv)
#endif
signal
(
SIGNAL_RELOAD
,
handler
);
signal
(
SIGINT
,
handler
);
if
((
ret
=
_srs_config
->
parse_options
(
argc
,
argv
))
!=
ERROR_SUCCESS
)
{
return
ret
;
...
...
请
注册
或
登录
后发表评论