winlin

build gperftools

@@ -33,6 +33,7 @@ gtest-1.6.0.zip @@ -33,6 +33,7 @@ gtest-1.6.0.zip
33 33
34 gperftools-2.1.zip 34 gperftools-2.1.zip
35 google性能分析和测试工具。 35 google性能分析和测试工具。
  36 + 编译和使用参考压缩文件中的README和doc目录。
36 37
37 links: 38 links:
38 ffmpeg: 39 ffmpeg:
@@ -427,3 +427,23 @@ if [ $SRS_UTEST = YES ]; then @@ -427,3 +427,23 @@ if [ $SRS_UTEST = YES ]; then
427 ret=$?; if [[ $ret -ne 0 ]]; then echo "build gtest-1.6.0 failed, ret=$ret"; exit $ret; fi 427 ret=$?; if [[ $ret -ne 0 ]]; then echo "build gtest-1.6.0 failed, ret=$ret"; exit $ret; fi
428 if [ ! -f ${SRS_OBJS}/gtest/include/gtest/gtest.h ]; then echo "build gtest-1.6.0 failed."; exit -1; fi 428 if [ ! -f ${SRS_OBJS}/gtest/include/gtest/gtest.h ]; then echo "build gtest-1.6.0 failed."; exit -1; fi
429 fi 429 fi
  430 +
  431 +#####################################################################################
  432 +# build gperf code
  433 +#####################################################################################
  434 +if [ $SRS_GPERF = YES ]; then
  435 + if [[ -f ${SRS_OBJS}/gperf/bin/pprof ]]; then
  436 + echo "gperftools-2.1 is ok.";
  437 + else
  438 + echo "build gperftools-2.1";
  439 + (
  440 + rm -rf ${SRS_OBJS}/gperftools-2.1 && cd ${SRS_OBJS} &&
  441 + unzip -q ../3rdparty/gperftools-2.1.zip && cd gperftools-2.1 &&
  442 + ./configure --prefix=`pwd`/_release --enable-frame-pointers && make ${SRS_JOBS} && make install &&
  443 + cd .. && rm -f gperf && ln -sf gperftools-2.1/_release gperf
  444 + )
  445 + fi
  446 + # check status
  447 + ret=$?; if [[ $ret -ne 0 ]]; then echo "build gperftools-2.1 failed, ret=$ret"; exit $ret; fi
  448 + if [ ! -f ${SRS_OBJS}/gperf/bin/pprof ]; then echo "build gperftools-2.1 failed."; exit -1; fi
  449 +fi
@@ -17,6 +17,7 @@ SRS_FFMPEG=RESERVED @@ -17,6 +17,7 @@ SRS_FFMPEG=RESERVED
17 SRS_HTTP=RESERVED 17 SRS_HTTP=RESERVED
18 SRS_RESEARCH=RESERVED 18 SRS_RESEARCH=RESERVED
19 SRS_UTEST=RESERVED 19 SRS_UTEST=RESERVED
  20 +SRS_GPERF=RESERVED
20 # arguments 21 # arguments
21 SRS_JOBS=1 22 SRS_JOBS=1
22 23
@@ -27,6 +28,7 @@ SRS_FFMPEG=YES @@ -27,6 +28,7 @@ SRS_FFMPEG=YES
27 SRS_HTTP=YES 28 SRS_HTTP=YES
28 SRS_RESEARCH=NO 29 SRS_RESEARCH=NO
29 SRS_UTEST=YES 30 SRS_UTEST=YES
  31 +SRS_GPERF=YES
30 32
31 ##################################################################################### 33 #####################################################################################
32 # parse options 34 # parse options
@@ -54,6 +56,7 @@ do @@ -54,6 +56,7 @@ do
54 --with-http) SRS_HTTP=YES ;; 56 --with-http) SRS_HTTP=YES ;;
55 --with-research) SRS_RESEARCH=YES ;; 57 --with-research) SRS_RESEARCH=YES ;;
56 --with-utest) SRS_UTEST=YES ;; 58 --with-utest) SRS_UTEST=YES ;;
  59 + --with-gperf) SRS_GPERF=YES ;;
57 60
58 --without-ssl) SRS_SSL=NO ;; 61 --without-ssl) SRS_SSL=NO ;;
59 --without-hls) SRS_HLS=NO ;; 62 --without-hls) SRS_HLS=NO ;;
@@ -61,6 +64,7 @@ do @@ -61,6 +64,7 @@ do
61 --without-http) SRS_HTTP=NO ;; 64 --without-http) SRS_HTTP=NO ;;
62 --without-research) SRS_RESEARCH=NO ;; 65 --without-research) SRS_RESEARCH=NO ;;
63 --without-utest) SRS_UTEST=NO ;; 66 --without-utest) SRS_UTEST=NO ;;
  67 + --without-gperf) SRS_GPERF=NO ;;
64 68
65 --jobs) SRS_JOBS=${value} ;; 69 --jobs) SRS_JOBS=${value} ;;
66 70
@@ -97,6 +101,7 @@ if [ $help = yes ]; then @@ -97,6 +101,7 @@ if [ $help = yes ]; then
97 --with-ffmpeg enable transcoding with ffmpeg. 101 --with-ffmpeg enable transcoding with ffmpeg.
98 --with-research build the research tools. 102 --with-research build the research tools.
99 --with-utest build the utest for srs. 103 --with-utest build the utest for srs.
  104 + --with-gperf build srs with gperf tools.
100 105
101 --without-ssl disable rtmp complex handshake. 106 --without-ssl disable rtmp complex handshake.
102 --without-hls disable hls, rtmp streaming only. 107 --without-hls disable hls, rtmp streaming only.
@@ -104,6 +109,7 @@ if [ $help = yes ]; then @@ -104,6 +109,7 @@ if [ $help = yes ]; then
104 --without-ffmpeg disable the ffmpeg transcoding feature. 109 --without-ffmpeg disable the ffmpeg transcoding feature.
105 --without-research do not build the research tools. 110 --without-research do not build the research tools.
106 --without-utest do not build the utest for srs. 111 --without-utest do not build the utest for srs.
  112 + --without-gperf do not build srs with gperf tools.
107 113
108 --jobs[=N] Allow N jobs at once; infinite jobs with no arg. 114 --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
109 used for make in the configure, for example, to make ffmpeg. 115 used for make in the configure, for example, to make ffmpeg.
@@ -140,6 +146,10 @@ if [ $SRS_UTEST = RESERVED ]; then @@ -140,6 +146,10 @@ if [ $SRS_UTEST = RESERVED ]; then
140 echo "you must specifies the utest, see: ./configure --help"; 146 echo "you must specifies the utest, see: ./configure --help";
141 __check_ok=NO 147 __check_ok=NO
142 fi 148 fi
  149 +if [ $SRS_GPERF = RESERVED ]; then
  150 + echo "you must specifies the gperf, see: ./configure --help";
  151 + __check_ok=NO
  152 +fi
143 if [ $__check_ok = NO ]; then 153 if [ $__check_ok = NO ]; then
144 exit 1; 154 exit 1;
145 fi 155 fi
@@ -311,6 +311,11 @@ if [ $SRS_UTEST = YES ]; then @@ -311,6 +311,11 @@ if [ $SRS_UTEST = YES ]; then
311 else 311 else
312 echo -e "${YELLOW}note: utest for srs are not builded${BLACK}" 312 echo -e "${YELLOW}note: utest for srs are not builded${BLACK}"
313 fi 313 fi
  314 +if [ $SRS_GPERF = YES ]; then
  315 + echo -e "${GREEN}gperf(mem leak detect, mem/cpu perf) for srs are builded${BLACK}"
  316 +else
  317 + echo -e "${YELLOW}note: gperf(mem leak detect, mem/cpu perf) for srs are not builded${BLACK}"
  318 +fi
314 319
315 ##################################################################################### 320 #####################################################################################
316 # next step 321 # next step