正在显示
4 个修改的文件
包含
42 行增加
和
11 行删除
| @@ -115,6 +115,8 @@ if [ $help = yes ]; then | @@ -115,6 +115,8 @@ if [ $help = yes ]; then | ||
| 115 | --with-utest build the utest for srs. | 115 | --with-utest build the utest for srs. |
| 116 | --with-gperf build srs with gperf tools(no gmc/gmp/gcp, with tcmalloc only). | 116 | --with-gperf build srs with gperf tools(no gmc/gmp/gcp, with tcmalloc only). |
| 117 | --with-gmc build memory check for srs with gperf tools. | 117 | --with-gmc build memory check for srs with gperf tools. |
| 118 | + --with-gmp build memory profile for srs with gperf tools. | ||
| 119 | + --with-gcp build cpu profile for srs with gperf tools. | ||
| 118 | 120 | ||
| 119 | --without-ssl disable rtmp complex handshake. | 121 | --without-ssl disable rtmp complex handshake. |
| 120 | --without-hls disable hls, rtmp streaming only. | 122 | --without-hls disable hls, rtmp streaming only. |
| @@ -124,6 +126,8 @@ if [ $help = yes ]; then | @@ -124,6 +126,8 @@ if [ $help = yes ]; then | ||
| 124 | --without-utest do not build the utest for srs. | 126 | --without-utest do not build the utest for srs. |
| 125 | --without-gperf do not build srs with gperf tools(without tcmalloc and gmc/gmp/gcp). | 127 | --without-gperf do not build srs with gperf tools(without tcmalloc and gmc/gmp/gcp). |
| 126 | --without-gmc do not build memory check for srs with gperf tools. | 128 | --without-gmc do not build memory check for srs with gperf tools. |
| 129 | + --without-gmp do not build memory profile for srs with gperf tools. | ||
| 130 | + --without-gcp do not build cpu profile for srs with gperf tools. | ||
| 127 | 131 | ||
| 128 | --jobs[=N] Allow N jobs at once; infinite jobs with no arg. | 132 | --jobs[=N] Allow N jobs at once; infinite jobs with no arg. |
| 129 | used for make in the configure, for example, to make ffmpeg. | 133 | used for make in the configure, for example, to make ffmpeg. |
| @@ -151,6 +155,14 @@ if [ $SRS_GPERF = NO ]; then | @@ -151,6 +155,14 @@ if [ $SRS_GPERF = NO ]; then | ||
| 151 | __check_ok=NO | 155 | __check_ok=NO |
| 152 | fi | 156 | fi |
| 153 | fi | 157 | fi |
| 158 | +if [ $SRS_GPERF_MC = YES ]; then | ||
| 159 | + if [ $SRS_GPERF_MP = YES ]; then | ||
| 160 | + echo "gperf-mc not compatible with gperf-mp, see: ./configure --help"; | ||
| 161 | + echo "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html"; | ||
| 162 | + 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"; | ||
| 163 | + __check_ok=NO | ||
| 164 | + fi | ||
| 165 | +fi | ||
| 154 | # check variable neccessary | 166 | # check variable neccessary |
| 155 | if [ $SRS_SSL = RESERVED ]; then | 167 | if [ $SRS_SSL = RESERVED ]; then |
| 156 | echo "you must specifies the ssl, see: ./configure --help"; | 168 | echo "you must specifies the ssl, see: ./configure --help"; |
| @@ -67,6 +67,7 @@ SrsUtestSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_UTEST = YES ]; then SrsU | @@ -67,6 +67,7 @@ SrsUtestSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_UTEST = YES ]; then SrsU | ||
| 67 | SrsGperfSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\$(GREEN)"; fi | 67 | SrsGperfSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\$(GREEN)"; fi |
| 68 | SrsGperfMCSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\$(GREEN)"; fi | 68 | SrsGperfMCSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\$(GREEN)"; fi |
| 69 | SrsGperfMPSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\$(GREEN)"; fi | 69 | SrsGperfMPSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\$(GREEN)"; fi |
| 70 | +SrsGperfCPSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\$(GREEN)"; fi | ||
| 70 | 71 | ||
| 71 | ##################################################################################### | 72 | ##################################################################################### |
| 72 | # makefile | 73 | # makefile |
| @@ -98,9 +99,14 @@ default: bandwidth librtmp-sample utest | @@ -98,9 +99,14 @@ default: bandwidth librtmp-sample utest | ||
| 98 | @echo -e " ${SrsGperfMCSummaryColor}gmc: gperf memory check, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\$(BLACK)" | 99 | @echo -e " ${SrsGperfMCSummaryColor}gmc: gperf memory check, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\$(BLACK)" |
| 99 | @echo -e " ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)" | 100 | @echo -e " ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)" |
| 100 | @echo -e " ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)" | 101 | @echo -e " ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)" |
| 101 | - @echo -e " ${SrsGperfMPSummaryColor}gmc: gperf memory profile, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\$(BLACK)" | ||
| 102 | - @echo -e " ${SrsGperfMPSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)" | ||
| 103 | - @echo -e " ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)" | 102 | + @echo -e " ${SrsGperfMPSummaryColor}gmp: gperf memory profile, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\$(BLACK)" |
| 103 | + @echo -e " ${SrsGperfMPSummaryColor}rm -f gperf.srs.gmp*; ./objs/srs -c conf/srs.conf # start gmp\$(BLACK)" | ||
| 104 | + @echo -e " ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmp\$(BLACK)" | ||
| 105 | + @echo -e " ${SrsGperfMPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gmp* # to analysis memory profile\$(BLACK)" | ||
| 106 | + @echo -e " ${SrsGperfCPSummaryColor}gcp: gperf cpu profile, @see: http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html\$(BLACK)" | ||
| 107 | + @echo -e " ${SrsGperfCPSummaryColor}rm -f gperf.srs.gcp*; ./objs/srs -c conf/srs.conf # start gcp\$(BLACK)" | ||
| 108 | + @echo -e " ${SrsGperfCPSummaryColor}killall -2 srs # or CTRL+C to stop gcp\$(BLACK)" | ||
| 109 | + @echo -e " ${SrsGperfCPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gcp* # to analysis cpu profile\$(BLACK)" | ||
| 104 | @echo -e "\$(GREEN)binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build\$(BLACK)" | 110 | @echo -e "\$(GREEN)binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build\$(BLACK)" |
| 105 | 111 | ||
| 106 | help: | 112 | help: |
| @@ -281,13 +281,16 @@ void SrsServer::on_signal(int signo) | @@ -281,13 +281,16 @@ void SrsServer::on_signal(int signo) | ||
| 281 | return; | 281 | return; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | -#ifdef SRS_GPERF_MC | ||
| 285 | if (signo == SIGINT) { | 284 | if (signo == SIGINT) { |
| 285 | +#ifdef SRS_GPERF_MC | ||
| 286 | srs_trace("gmc is on, main cycle will terminate normally."); | 286 | srs_trace("gmc is on, main cycle will terminate normally."); |
| 287 | signal_gmc_stop = true; | 287 | signal_gmc_stop = true; |
| 288 | +#else | ||
| 289 | + srs_trace("user terminate program"); | ||
| 290 | + exit(0); | ||
| 291 | +#endif | ||
| 288 | return; | 292 | return; |
| 289 | } | 293 | } |
| 290 | -#endif | ||
| 291 | 294 | ||
| 292 | // TODO: handle the SIGINT, SIGTERM. | 295 | // TODO: handle the SIGINT, SIGTERM. |
| 293 | } | 296 | } |
| @@ -37,10 +37,10 @@ SrsServer* _srs_server = new SrsServer(); | @@ -37,10 +37,10 @@ SrsServer* _srs_server = new SrsServer(); | ||
| 37 | #include <stdlib.h> | 37 | #include <stdlib.h> |
| 38 | #include <signal.h> | 38 | #include <signal.h> |
| 39 | 39 | ||
| 40 | -#ifdef SRS_GPERF_HEAP_PROFILE | 40 | +#ifdef SRS_GPERF_MP |
| 41 | #include <gperftools/heap-profiler.h> | 41 | #include <gperftools/heap-profiler.h> |
| 42 | #endif | 42 | #endif |
| 43 | -#ifdef SRS_GPERF_CPU_PROFILE | 43 | +#ifdef SRS_GPERF_CP |
| 44 | #include <gperftools/profiler.h> | 44 | #include <gperftools/profiler.h> |
| 45 | #endif | 45 | #endif |
| 46 | 46 | ||
| @@ -54,11 +54,11 @@ int main(int argc, char** argv) | @@ -54,11 +54,11 @@ int main(int argc, char** argv) | ||
| 54 | { | 54 | { |
| 55 | int ret = ERROR_SUCCESS; | 55 | int ret = ERROR_SUCCESS; |
| 56 | 56 | ||
| 57 | -#ifdef SRS_GPERF_HEAP_PROFILE | ||
| 58 | - HeapProfilerStart("gperf.srs"); | 57 | +#ifdef SRS_GPERF_MP |
| 58 | + HeapProfilerStart("gperf.srs.gmp"); | ||
| 59 | #endif | 59 | #endif |
| 60 | -#ifdef SRS_GPERF_CPU_PROFILE | ||
| 61 | - ProfilerStart("gperf.srs.prof"); | 60 | +#ifdef SRS_GPERF_CP |
| 61 | + ProfilerStart("gperf.srs.gcp"); | ||
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | signal(SIGNAL_RELOAD, handler); | 64 | signal(SIGNAL_RELOAD, handler); |
| @@ -68,6 +68,16 @@ int main(int argc, char** argv) | @@ -68,6 +68,16 @@ int main(int argc, char** argv) | ||
| 68 | return ret; | 68 | return ret; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | +#ifdef SRS_GPERF_MC | ||
| 72 | + #ifdef SRS_GPERF_MP | ||
| 73 | + srs_error("option --with-gmc confict with --with-gmp, " | ||
| 74 | + "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\n" | ||
| 75 | + "Note that since the heap-checker uses the heap-profiling framework internally, " | ||
| 76 | + "it is not possible to run both the heap-checker and heap profiler at the same time"); | ||
| 77 | + return -1; | ||
| 78 | + #endif | ||
| 79 | +#endif | ||
| 80 | + | ||
| 71 | if ((ret = _srs_server->initialize()) != ERROR_SUCCESS) { | 81 | if ((ret = _srs_server->initialize()) != ERROR_SUCCESS) { |
| 72 | return ret; | 82 | return ret; |
| 73 | } | 83 | } |
-
请 注册 或 登录 后发表评论