winlin

add --with-gprof support

@@ -28,3 +28,4 @@ gprof2dot.py: @@ -28,3 +28,4 @@ gprof2dot.py:
28 备注: 28 备注:
29 其实gprof生成的日志就可以看,不一定要图形化。 29 其实gprof生成的日志就可以看,不一定要图形化。
30 也就是dot和gprof2dot都不用执行。 30 也就是dot和gprof2dot都不用执行。
  31 + 参考:http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html
@@ -21,6 +21,7 @@ SRS_GPERF=RESERVED # tcmalloc @@ -21,6 +21,7 @@ SRS_GPERF=RESERVED # tcmalloc
21 SRS_GPERF_MC=RESERVED # gperf memory check 21 SRS_GPERF_MC=RESERVED # gperf memory check
22 SRS_GPERF_MP=RESERVED # gperf memory profile 22 SRS_GPERF_MP=RESERVED # gperf memory profile
23 SRS_GPERF_CP=RESERVED # gperf cpu profile 23 SRS_GPERF_CP=RESERVED # gperf cpu profile
  24 +SRS_GPROF=RESERVED # gprof
24 # arguments 25 # arguments
25 SRS_JOBS=1 26 SRS_JOBS=1
26 27
@@ -35,6 +36,7 @@ SRS_GPERF=NO @@ -35,6 +36,7 @@ SRS_GPERF=NO
35 SRS_GPERF_MC=NO 36 SRS_GPERF_MC=NO
36 SRS_GPERF_MP=NO 37 SRS_GPERF_MP=NO
37 SRS_GPERF_CP=NO 38 SRS_GPERF_CP=NO
  39 +SRS_GPROF=NO
38 40
39 ##################################################################################### 41 #####################################################################################
40 # parse options 42 # parse options
@@ -66,6 +68,7 @@ do @@ -66,6 +68,7 @@ do
66 --with-gmc) SRS_GPERF_MC=YES ;; 68 --with-gmc) SRS_GPERF_MC=YES ;;
67 --with-gmp) SRS_GPERF_MP=YES ;; 69 --with-gmp) SRS_GPERF_MP=YES ;;
68 --with-gcp) SRS_GPERF_CP=YES ;; 70 --with-gcp) SRS_GPERF_CP=YES ;;
  71 + --with-gprof) SRS_GPROF=YES ;;
69 72
70 --without-ssl) SRS_SSL=NO ;; 73 --without-ssl) SRS_SSL=NO ;;
71 --without-hls) SRS_HLS=NO ;; 74 --without-hls) SRS_HLS=NO ;;
@@ -77,6 +80,7 @@ do @@ -77,6 +80,7 @@ do
77 --without-gmc) SRS_GPERF_MC=NO ;; 80 --without-gmc) SRS_GPERF_MC=NO ;;
78 --without-gmp) SRS_GPERF_MP=NO ;; 81 --without-gmp) SRS_GPERF_MP=NO ;;
79 --without-gcp) SRS_GPERF_CP=NO ;; 82 --without-gcp) SRS_GPERF_CP=NO ;;
  83 + --without-gprof) SRS_GPROF=NO ;;
80 84
81 --jobs) SRS_JOBS=${value} ;; 85 --jobs) SRS_JOBS=${value} ;;
82 86
@@ -117,6 +121,7 @@ if [ $help = yes ]; then @@ -117,6 +121,7 @@ if [ $help = yes ]; then
117 --with-gmc build memory check for srs with gperf tools. 121 --with-gmc build memory check for srs with gperf tools.
118 --with-gmp build memory profile for srs with gperf tools. 122 --with-gmp build memory profile for srs with gperf tools.
119 --with-gcp build cpu profile for srs with gperf tools. 123 --with-gcp build cpu profile for srs with gperf tools.
  124 + --with-gprof build srs with gprof(GNU profile tool).
120 125
121 --without-ssl disable rtmp complex handshake. 126 --without-ssl disable rtmp complex handshake.
122 --without-hls disable hls, rtmp streaming only. 127 --without-hls disable hls, rtmp streaming only.
@@ -128,6 +133,7 @@ if [ $help = yes ]; then @@ -128,6 +133,7 @@ if [ $help = yes ]; then
128 --without-gmc do not build memory check for srs with gperf tools. 133 --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. 134 --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. 135 --without-gcp do not build cpu profile for srs with gperf tools.
  136 + --without-gprof do not build srs with gprof(GNU profile tool).
131 137
132 --jobs[=N] Allow N jobs at once; infinite jobs with no arg. 138 --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
133 used for make in the configure, for example, to make ffmpeg. 139 used for make in the configure, for example, to make ffmpeg.
@@ -163,6 +169,26 @@ if [ $SRS_GPERF_MC = YES ]; then @@ -163,6 +169,26 @@ if [ $SRS_GPERF_MC = YES ]; then
163 __check_ok=NO 169 __check_ok=NO
164 fi 170 fi
165 fi 171 fi
  172 +# generate the group option: SRS_GPERF
  173 +__gperf_slow=NO
  174 +if [ $SRS_GPERF_MC = YES ]; then
  175 + SRS_GPERF=YES
  176 + __gperf_slow=YES
  177 +fi
  178 +if [ $SRS_GPERF_MP = YES ]; then
  179 + SRS_GPERF=YES
  180 + __gperf_slow=YES
  181 +fi
  182 +if [ $SRS_GPERF_CP = YES ]; then
  183 + SRS_GPERF=YES
  184 + __gperf_slow=YES
  185 +fi
  186 +if [ $__gperf_slow = YES ]; then
  187 + if [ $SRS_GPROF = YES ]; then
  188 + echo "gmc/gmp/gcp not compatible with gprof, see: ./configure --help";
  189 + __check_ok=NO
  190 + fi
  191 +fi
166 # check variable neccessary 192 # check variable neccessary
167 if [ $SRS_SSL = RESERVED ]; then 193 if [ $SRS_SSL = RESERVED ]; then
168 echo "you must specifies the ssl, see: ./configure --help"; 194 echo "you must specifies the ssl, see: ./configure --help";
@@ -188,6 +214,10 @@ if [ $SRS_UTEST = RESERVED ]; then @@ -188,6 +214,10 @@ if [ $SRS_UTEST = RESERVED ]; then
188 echo "you must specifies the utest, see: ./configure --help"; 214 echo "you must specifies the utest, see: ./configure --help";
189 __check_ok=NO 215 __check_ok=NO
190 fi 216 fi
  217 +if [ $SRS_GPROF = RESERVED ]; then
  218 + echo "you must specifies the gprof, see: ./configure --help";
  219 + __check_ok=NO
  220 +fi
191 if [ $SRS_GPERF_MC = RESERVED ]; then 221 if [ $SRS_GPERF_MC = RESERVED ]; then
192 echo "you must specifies the gperf-mc, see: ./configure --help"; 222 echo "you must specifies the gperf-mc, see: ./configure --help";
193 __check_ok=NO 223 __check_ok=NO
@@ -203,14 +233,3 @@ fi @@ -203,14 +233,3 @@ fi
203 if [ $__check_ok = NO ]; then 233 if [ $__check_ok = NO ]; then
204 exit 1; 234 exit 1;
205 fi 235 fi
206 -  
207 -# generate the group option: SRS_GPERF  
208 -if [ $SRS_GPERF_MC = YES ]; then  
209 - SRS_GPERF=YES  
210 -fi  
211 -if [ $SRS_GPERF_MP = YES ]; then  
212 - SRS_GPERF=YES  
213 -fi  
214 -if [ $SRS_GPERF_CP = YES ]; then  
215 - SRS_GPERF=YES  
216 -fi  
@@ -62,12 +62,13 @@ SrsHlsSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_HLS = YES ]; then SrsHlsSu @@ -62,12 +62,13 @@ SrsHlsSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_HLS = YES ]; then SrsHlsSu
62 SrsSslSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_SSL = YES ]; then SrsSslSummaryColor="\$(GREEN)"; fi 62 SrsSslSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_SSL = YES ]; then SrsSslSummaryColor="\$(GREEN)"; fi
63 SrsFfmpegSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_FFMPEG = YES ]; then SrsFfmpegSummaryColor="\$(GREEN)"; fi 63 SrsFfmpegSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_FFMPEG = YES ]; then SrsFfmpegSummaryColor="\$(GREEN)"; fi
64 SrsHttpSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_HTTP = YES ]; then SrsHttpSummaryColor="\$(GREEN)"; fi 64 SrsHttpSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_HTTP = YES ]; then SrsHttpSummaryColor="\$(GREEN)"; fi
65 -SrsResearchSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\$(GREEN)"; fi 65 +SrsResearchSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\$(GREEN)"; fi
66 SrsUtestSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\$(GREEN)"; fi 66 SrsUtestSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\$(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  
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 67 +SrsGperfSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\$(GREEN)"; fi
  68 +SrsGperfMCSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\$(YELLOW)"; fi
  69 +SrsGperfMPSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\$(YELLOW)"; fi
  70 +SrsGperfCPSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\$(YELLOW)"; fi
  71 +SrsGprofSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\$(YELLOW)"; fi
71 72
72 ##################################################################################### 73 #####################################################################################
73 # makefile 74 # makefile
@@ -83,30 +84,50 @@ BLACK="\\${BLACK}" @@ -83,30 +84,50 @@ BLACK="\\${BLACK}"
83 84
84 default: bandwidth librtmp-sample utest 85 default: bandwidth librtmp-sample utest
85 @echo -e "\$(GREEN)build summary:\$(BLACK)" 86 @echo -e "\$(GREEN)build summary:\$(BLACK)"
86 - @echo -e " \$(GREEN)server: ./objs/srs, the srs server\$(BLACK)"  
87 - @echo -e " ${SrsHlsSummaryColor}hls: delivery HLS stream, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\$(BLACK)"  
88 - @echo -e " ${SrsSslSummaryColor}ssl: support RTMP complex handshake, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/RTMPHandshake\$(BLACK)"  
89 - @echo -e " ${SrsFfmpegSummaryColor}ffmpeg: support transcoding with FFMPEG, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/FFMPEG\$(BLACK)"  
90 - @echo -e " ${SrsHttpSummaryColor}http: support http callback, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPCallback\$(BLACK)"  
91 - @echo -e " \$(GREEN)bandwidth: ./objs/bandwidth, the bandwidth test client\$(BLACK)"  
92 - @echo -e " \$(GREEN)librtmp: ./objs/include, ./objs/lib, the srs-librtmp library, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLibrtmp\$(BLACK)"  
93 - @echo -e " \$(GREEN)simple handshake: publish/play stream with simple handshake to server\$(BLACK)"  
94 - @echo -e " ${SrsSslSummaryColor}complex handshake: it's not required to publish/play stream for client, recommend disable it for srs-librtmp\$(BLACK)"  
95 - @echo -e " \$(GREEN)librtmp-sample: ./research/librtmp, the srs-librtmp client sample\$(BLACK)"  
96 - @echo -e " ${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info.\$(BLACK)"  
97 - @echo -e " ${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\$(BLACK)"  
98 - @echo -e " ${SrsGperfSummaryColor}gperf: gmc/gmp/gcp for srs, @see: \$(BLACK)"  
99 - @echo -e " ${SrsGperfMCSummaryColor}gmc: gperf memory check, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\$(BLACK)"  
100 - @echo -e " ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)"  
101 - @echo -e " ${SrsGperfMCSummaryColor}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)" 87 + @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"
  88 + @echo -e " |${SrsGperfSummaryColor}gperf @see: https://github.com/winlinvip/simple-rtmp-server/wiki/GPERF\$(BLACK)"
  89 + @echo -e " | ${SrsGperfMCSummaryColor}gmc @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\$(BLACK)"
  90 + @echo -e " | ${SrsGperfMCSummaryColor}gmc: gperf memory check\$(BLACK)"
  91 + @echo -e " | ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)"
  92 + @echo -e " | ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)"
  93 + @echo -e " | ${SrsGperfMPSummaryColor}gmp @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\$(BLACK)"
  94 + @echo -e " | ${SrsGperfMPSummaryColor}gmp: gperf memory profile\$(BLACK)"
  95 + @echo -e " | ${SrsGperfMPSummaryColor}rm -f gperf.srs.gmp*; ./objs/srs -c conf/srs.conf # start gmp\$(BLACK)"
  96 + @echo -e " | ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmp\$(BLACK)"
  97 + @echo -e " | ${SrsGperfMPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gmp* # to analysis memory profile\$(BLACK)"
  98 + @echo -e " | ${SrsGperfCPSummaryColor}gcp @see: http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html\$(BLACK)"
  99 + @echo -e " | ${SrsGperfCPSummaryColor}gcp: gperf cpu profile\$(BLACK)"
  100 + @echo -e " | ${SrsGperfCPSummaryColor}rm -f gperf.srs.gcp*; ./objs/srs -c conf/srs.conf # start gcp\$(BLACK)"
  101 + @echo -e " | ${SrsGperfCPSummaryColor}killall -2 srs # or CTRL+C to stop gcp\$(BLACK)"
  102 + @echo -e " | ${SrsGperfCPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gcp* # to analysis cpu profile\$(BLACK)"
  103 + @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"
  104 + @echo -e " |${SrsGprofSummaryColor}gprof @see: https://github.com/winlinvip/simple-rtmp-server/wiki/GPROF\$(BLACK)"
  105 + @echo -e " |${SrsGprofSummaryColor}gprof: GNU profile tool, @see: http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html\$(BLACK)"
  106 + @echo -e " | ${SrsGprofSummaryColor}rm -f gmon.out; ./objs/srs -c conf/srs.conf # start gprof\$(BLACK)"
  107 + @echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof.srs.log && rm -f gmon.out # gprof report to gprof.srs.log\$(BLACK)"
  108 + @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"
  109 + @echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info.\$(BLACK)"
  110 + @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"
  111 + @echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\$(BLACK)"
  112 + @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"
  113 + @echo -e " |\$(GREEN)bandwidth: ./objs/bandwidth, the bandwidth test client\$(BLACK)"
  114 + @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"
  115 + @echo -e " |\$(GREEN)librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLibrtmp\$(BLACK)"
  116 + @echo -e " |\$(GREEN)librtmp: ./objs/include, ./objs/lib, the srs-librtmp library\$(BLACK)"
  117 + @echo -e " | \$(GREEN)simple handshake: publish/play stream with simple handshake to server\$(BLACK)"
  118 + @echo -e " | ${SrsSslSummaryColor}complex handshake: it's not required for client, recommend disable it\$(BLACK)"
  119 + @echo -e " | \$(GREEN)librtmp-sample: ./research/librtmp, the srs-librtmp client sample\$(BLACK)"
  120 + @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"
  121 + @echo -e " |\$(GREEN)server: ./objs/srs, the srs server\$(BLACK)"
  122 + @echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\$(BLACK)"
  123 + @echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts, delivery HLS stream by nginx\$(BLACK)"
  124 + @echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/RTMPHandshake\$(BLACK)"
  125 + @echo -e " | ${SrsSslSummaryColor}ssl: support RTMP complex handshake for client required, for instance, flash\$(BLACK)"
  126 + @echo -e " | ${SrsFfmpegSummaryColor}ffmpeg @see: https://github.com/winlinvip/simple-rtmp-server/wiki/FFMPEG\$(BLACK)"
  127 + @echo -e " | ${SrsFfmpegSummaryColor}ffmpeg: support transcoding RTMP stream with FFMPEG\$(BLACK)"
  128 + @echo -e " | ${SrsHttpSummaryColor}http @see: https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPCallback\$(BLACK)"
  129 + @echo -e " | ${SrsHttpSummaryColor}http: support http callback for authentication and event injection\$(BLACK)"
  130 + @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"
110 @echo -e "\$(GREEN)binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build\$(BLACK)" 131 @echo -e "\$(GREEN)binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build\$(BLACK)"
111 132
112 help: 133 help:
@@ -155,15 +176,19 @@ END @@ -155,15 +176,19 @@ END
155 ##################################################################################### 176 #####################################################################################
156 # build tools or compiler args. 177 # build tools or compiler args.
157 # enable gdb debug 178 # enable gdb debug
158 -GDBDebug="-g -O0" 179 +GDBDebug=" -g -O0"
159 # the warning level. 180 # the warning level.
160 -WarnLevel="-Wall" 181 +WarnLevel=" -Wall"
161 # the compile standard. 182 # the compile standard.
162 CppStd="-ansi" 183 CppStd="-ansi"
163 # for library compile 184 # for library compile
164 -LibraryCompile="-fPIC" 185 +LibraryCompile=" -fPIC"
  186 +# performance of gprof
  187 +SrsGprof=""; SrsGprofLink=""; if [ $SRS_GPROF = YES ]; then SrsGprof=" -pg -lc_p"; SrsGprofLink=" -pg"; fi
  188 +# performance of gperf
  189 +SrsGperf=""; SrsGperfLink=""; if [ $SRS_GPERF = YES ]; then SrsGperfLink=" -lpthread"; fi
165 # the cxx flag generated. 190 # the cxx flag generated.
166 -CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${LibraryCompile}" 191 +CXXFLAGS="${CppStd}${WarnLevel}${GDBDebug}${LibraryCompile}${SrsGprof}"
167 if [ $SRS_GPERF = YES ]; then CXXFLAGS="${CXXFLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"; fi 192 if [ $SRS_GPERF = YES ]; then CXXFLAGS="${CXXFLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"; fi
168 cat << END > ${SRS_OBJS}/${SRS_MAKEFILE} 193 cat << END > ${SRS_OBJS}/${SRS_MAKEFILE}
169 CC ?= gcc 194 CC ?= gcc
@@ -262,8 +287,7 @@ MAIN_ENTRANCES=("srs_main_server" "srs_main_bandcheck") @@ -262,8 +287,7 @@ MAIN_ENTRANCES=("srs_main_server" "srs_main_bandcheck")
262 ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile} ${LibGperfFile}) 287 ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile} ${LibGperfFile})
263 # all depends objects 288 # all depends objects
264 MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}" 289 MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}"
265 -LINK_OPTIONS="-ldl"  
266 -if [ $SRS_GPERF = YES ]; then LINK_OPTIONS="${LINK_OPTIONS} -lpthread"; fi 290 +LINK_OPTIONS="-ldl${SrsGprofLink}${SrsGperfLink}"
267 # 291 #
268 # srs: 292 # srs:
269 # srs(simple rtmp server) over st(state-threads) 293 # srs(simple rtmp server) over st(state-threads)
@@ -329,20 +353,30 @@ if [ $SRS_UTEST = YES ]; then @@ -329,20 +353,30 @@ if [ $SRS_UTEST = YES ]; then
329 else 353 else
330 echo -e "${YELLOW}note: utest for srs are not builded${BLACK}" 354 echo -e "${YELLOW}note: utest for srs are not builded${BLACK}"
331 fi 355 fi
  356 +if [ $SRS_GPERF = YES ]; then
  357 + echo -e "${GREEN}gperf(tcmalloc) for srs are builded${BLACK}"
  358 +else
  359 + echo -e "${BLACK}note: gperf(tcmalloc) for srs are not builded${BLACK}"
  360 +fi
332 if [ $SRS_GPERF_MC = YES ]; then 361 if [ $SRS_GPERF_MC = YES ]; then
333 - echo -e "${GREEN}gmc(gperf memory check) for srs are builded${BLACK}" 362 + echo -e "${YELLOW}gmc(gperf memory check) for srs are builded -- Performance may suffer${BLACK}"
334 else 363 else
335 - echo -e "${YELLOW}note: gmc(gperf memory check) for srs are not builded${BLACK}" 364 + echo -e "${GREEN}note: gmc(gperf memory check) for srs are not builded${BLACK}"
336 fi 365 fi
337 if [ $SRS_GPERF_MP = YES ]; then 366 if [ $SRS_GPERF_MP = YES ]; then
338 - echo -e "${GREEN}gmp(gperf memory profile) for srs are builded${BLACK}" 367 + echo -e "${YELLOW}gmp(gperf memory profile) for srs are builded -- Performance may suffer${BLACK}"
339 else 368 else
340 - echo -e "${YELLOW}note: gmp(gperf memory profile) for srs are not builded${BLACK}" 369 + echo -e "${GREEN}note: gmp(gperf memory profile) for srs are not builded${BLACK}"
341 fi 370 fi
342 if [ $SRS_GPERF_CP = YES ]; then 371 if [ $SRS_GPERF_CP = YES ]; then
343 - echo -e "${GREEN}gcp(gperf cpu profile) for srs are builded${BLACK}" 372 + echo -e "${YELLOW}gcp(gperf cpu profile) for srs are builded -- Performance may suffer${BLACK}"
  373 +else
  374 + echo -e "${GREEN}note: gcp(gperf cpu profile) for srs are not builded${BLACK}"
  375 +fi
  376 +if [ $SRS_GPROF = YES ]; then
  377 + echo -e "${YELLOW}gprof(GNU profile tool) for srs are builded -- Performance may suffer${BLACK}"
344 else 378 else
345 - echo -e "${YELLOW}note: gcp(gperf cpu profile) for srs are not builded${BLACK}" 379 + echo -e "${GREEN}note: gprof(GNU profile tool) for srs are not builded${BLACK}"
346 fi 380 fi
347 381
348 ##################################################################################### 382 #####################################################################################