full support gperf gmc/gmp/gcp

pull/133/head
winlin 11 years ago
parent 8cd1c11add
commit 6e0bebdacf

@ -115,6 +115,8 @@ if [ $help = yes ]; then
--with-utest build the utest for srs.
--with-gperf build srs with gperf tools(no gmc/gmp/gcp, with tcmalloc only).
--with-gmc build memory check for srs with gperf tools.
--with-gmp build memory profile for srs with gperf tools.
--with-gcp build cpu profile for srs with gperf tools.
--without-ssl disable rtmp complex handshake.
--without-hls disable hls, rtmp streaming only.
@ -124,6 +126,8 @@ if [ $help = yes ]; then
--without-utest do not build the utest for srs.
--without-gperf do not build srs with gperf tools(without tcmalloc and gmc/gmp/gcp).
--without-gmc do not build memory check for srs with gperf tools.
--without-gmp do not build memory profile for srs with gperf tools.
--without-gcp do not build cpu profile 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.
@ -151,6 +155,14 @@ if [ $SRS_GPERF = NO ]; then
__check_ok=NO
fi
fi
if [ $SRS_GPERF_MC = YES ]; then
if [ $SRS_GPERF_MP = YES ]; then
echo "gperf-mc not compatible with gperf-mp, see: ./configure --help";
echo "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html";
echo "Note that since the heap-checker uses the heap-profiling framework internally, it is not possible to run both the heap-checker and heap profiler at the same time";
__check_ok=NO
fi
fi
# check variable neccessary
if [ $SRS_SSL = RESERVED ]; then
echo "you must specifies the ssl, see: ./configure --help";

12
trunk/configure vendored

@ -67,6 +67,7 @@ SrsUtestSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_UTEST = YES ]; then SrsU
SrsGperfSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\$(GREEN)"; fi
SrsGperfMCSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\$(GREEN)"; fi
SrsGperfMPSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\$(GREEN)"; fi
SrsGperfCPSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\$(GREEN)"; fi
#####################################################################################
# makefile
@ -98,9 +99,14 @@ default: bandwidth librtmp-sample utest
@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 " ${SrsGperfMPSummaryColor}gmc: gperf memory profile, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\$(BLACK)"
@echo -e " ${SrsGperfMPSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)"
@echo -e " ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)"
@echo -e " ${SrsGperfMPSummaryColor}gmp: gperf memory profile, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\$(BLACK)"
@echo -e " ${SrsGperfMPSummaryColor}rm -f gperf.srs.gmp*; ./objs/srs -c conf/srs.conf # start gmp\$(BLACK)"
@echo -e " ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmp\$(BLACK)"
@echo -e " ${SrsGperfMPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gmp* # to analysis memory profile\$(BLACK)"
@echo -e " ${SrsGperfCPSummaryColor}gcp: gperf cpu profile, @see: http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html\$(BLACK)"
@echo -e " ${SrsGperfCPSummaryColor}rm -f gperf.srs.gcp*; ./objs/srs -c conf/srs.conf # start gcp\$(BLACK)"
@echo -e " ${SrsGperfCPSummaryColor}killall -2 srs # or CTRL+C to stop gcp\$(BLACK)"
@echo -e " ${SrsGperfCPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gcp* # to analysis cpu profile\$(BLACK)"
@echo -e "\$(GREEN)binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build\$(BLACK)"
help:

@ -281,13 +281,16 @@ void SrsServer::on_signal(int signo)
return;
}
#ifdef SRS_GPERF_MC
if (signo == SIGINT) {
#ifdef SRS_GPERF_MC
srs_trace("gmc is on, main cycle will terminate normally.");
signal_gmc_stop = true;
#else
srs_trace("user terminate program");
exit(0);
#endif
return;
}
#endif
// TODO: handle the SIGINT, SIGTERM.
}

@ -37,10 +37,10 @@ SrsServer* _srs_server = new SrsServer();
#include <stdlib.h>
#include <signal.h>
#ifdef SRS_GPERF_HEAP_PROFILE
#ifdef SRS_GPERF_MP
#include <gperftools/heap-profiler.h>
#endif
#ifdef SRS_GPERF_CPU_PROFILE
#ifdef SRS_GPERF_CP
#include <gperftools/profiler.h>
#endif
@ -54,11 +54,11 @@ int main(int argc, char** argv)
{
int ret = ERROR_SUCCESS;
#ifdef SRS_GPERF_HEAP_PROFILE
HeapProfilerStart("gperf.srs");
#ifdef SRS_GPERF_MP
HeapProfilerStart("gperf.srs.gmp");
#endif
#ifdef SRS_GPERF_CPU_PROFILE
ProfilerStart("gperf.srs.prof");
#ifdef SRS_GPERF_CP
ProfilerStart("gperf.srs.gcp");
#endif
signal(SIGNAL_RELOAD, handler);
@ -67,6 +67,16 @@ int main(int argc, char** argv)
if ((ret = _srs_config->parse_options(argc, argv)) != ERROR_SUCCESS) {
return ret;
}
#ifdef SRS_GPERF_MC
#ifdef SRS_GPERF_MP
srs_error("option --with-gmc confict with --with-gmp, "
"@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\n"
"Note that since the heap-checker uses the heap-profiling framework internally, "
"it is not possible to run both the heap-checker and heap profiler at the same time");
return -1;
#endif
#endif
if ((ret = _srs_server->initialize()) != ERROR_SUCCESS) {
return ret;

Loading…
Cancel
Save