正在显示
6 个修改的文件
包含
12 行增加
和
6 行删除
| @@ -10,8 +10,8 @@ fi | @@ -10,8 +10,8 @@ fi | ||
| 10 | sudo echo "ok" > /dev/null 2>&1; | 10 | sudo echo "ok" > /dev/null 2>&1; |
| 11 | ret=$?; if [[ 0 -ne ${ret} ]]; then echo "you must be sudoer"; exit 1; fi | 11 | ret=$?; if [[ 0 -ne ${ret} ]]; then echo "you must be sudoer"; exit 1; fi |
| 12 | 12 | ||
| 13 | -tar xf graphviz-2.18.tar.gz | ||
| 14 | -cd graphviz-2.18 && ./configure && make && sudo make install | 13 | +tar xf graphviz-2.36.0.zip |
| 14 | +cd graphviz-2.36.0 && ./configure && make && sudo make install | ||
| 15 | ret=$?; if [[ $ret -ne 0 ]]; then echo "build gprof2dot failed."; exit $ret; fi | 15 | ret=$?; if [[ $ret -ne 0 ]]; then echo "build gprof2dot failed."; exit $ret; fi |
| 16 | 16 | ||
| 17 | echo "we test in Centos6.0, it's ok" | 17 | echo "we test in Centos6.0, it's ok" |
This file is too large to display.
trunk/3rdparty/gprof/graphviz-2.36.0.zip
0 → 100644
This file is too large to display.
trunk/3rdparty/gprof/readme.txt
100755 → 100644
| 1 | gprof图形化输出工具: gprof2dot.py graphviz-2.18.tar.gz build_gprof2dot.sh | 1 | gprof图形化输出工具: gprof2dot.py graphviz-2.18.tar.gz build_gprof2dot.sh |
| 2 | 2 | ||
| 3 | dot: | 3 | dot: |
| 4 | + http://www.graphviz.org/ | ||
| 5 | + http://www.graphviz.org/Download_source.php | ||
| 4 | graphviz-2.18.tar.gz 绘图工具 | 6 | graphviz-2.18.tar.gz 绘图工具 |
| 5 | build_gprof2dot.sh 编译graphviz,命令为dot。 | 7 | build_gprof2dot.sh 编译graphviz,命令为dot。 |
| 6 | 要求是sudoer,需要sudo make install。 | 8 | 要求是sudoer,需要sudo make install。 |
| @@ -9,21 +11,24 @@ gprof2dot.py: | @@ -9,21 +11,24 @@ gprof2dot.py: | ||
| 9 | 将gprof的日志绘图。 | 11 | 将gprof的日志绘图。 |
| 10 | 12 | ||
| 11 | 使用方法: | 13 | 使用方法: |
| 12 | -1. srs配置时,指定 --with-pg | 14 | +0. 若需要图形化,编译dot: |
| 15 | + cd 3rdparty/gprof && bash build_gprof2dot.sh | ||
| 16 | +1. srs配置时: | ||
| 17 | + ./configure --with-pg | ||
| 13 | 脚本会加入编译参数"-pg -lc_p",gcc -g -pg -lc_p -c xxx -o xxx.o,即在configure中打开 Performance="-pg -lc_p" | 18 | 脚本会加入编译参数"-pg -lc_p",gcc -g -pg -lc_p -c xxx -o xxx.o,即在configure中打开 Performance="-pg -lc_p" |
| 14 | 链接时,加入链接选项"-pg",否则无法工作:gcc -pg -o srs xxxx.o,即在configure中打开 PerformanceLink="-pg" | 19 | 链接时,加入链接选项"-pg",否则无法工作:gcc -pg -o srs xxxx.o,即在configure中打开 PerformanceLink="-pg" |
| 15 | 2. 编译和启动程序:make && ./objs/srs -c conf/srs.conf | 20 | 2. 编译和启动程序:make && ./objs/srs -c conf/srs.conf |
| 16 | 退出程序,按CTRL+C,可以看到生成了gmon.out,这个就是性能的统计数据。 | 21 | 退出程序,按CTRL+C,可以看到生成了gmon.out,这个就是性能的统计数据。 |
| 17 | 3. gprof生成报表: | 22 | 3. gprof生成报表: |
| 18 | - 用gprof生成报表:gprof -b ./objs/srs gmon.out > ~/t.log | 23 | + gprof -b ./objs/srs gmon.out > gprof.srs.log |
| 19 | 4. 将报表生成图片: | 24 | 4. 将报表生成图片: |
| 20 | - ../3rdparty/gprof/gprof2dot.py ~/t.log | dot -Tpng -o ~/out.png | 25 | + ./3rdparty/gprof/gprof2dot.py gprof.srs.log | dot -Tpng -o ~/winlin.png |
| 21 | 26 | ||
| 22 | 缩写语句: | 27 | 缩写语句: |
| 23 | # 生成 ~/winlin.log ~/winlin.png | 28 | # 生成 ~/winlin.log ~/winlin.png |
| 24 | rm -f gmon.out; ./objs/srs -c conf/srs.conf | 29 | rm -f gmon.out; ./objs/srs -c conf/srs.conf |
| 25 | # 用户按CTRL+C | 30 | # 用户按CTRL+C |
| 26 | - file="winlin";gprof -b ./objs/srs gmon.out > ~/${file}.log; ../thirdparty/gprof2dot.py ~/${file}.log| dot -Tpng -o ~/${file}.png | 31 | + file="winlin";gprof -b ./objs/srs gmon.out > ~/${file}.log; ./3rdparty/gprof/gprof2dot.py ~/${file}.log | dot -Tpng -o ~/${file}.png |
| 27 | 32 | ||
| 28 | 备注: | 33 | 备注: |
| 29 | 其实gprof生成的日志就可以看,不一定要图形化。 | 34 | 其实gprof生成的日志就可以看,不一定要图形化。 |
trunk/3rdparty/gprof/winlin.png
0 → 100644
119.8 KB
| @@ -104,6 +104,7 @@ default: bandwidth librtmp-sample utest | @@ -104,6 +104,7 @@ default: bandwidth librtmp-sample utest | ||
| 104 | @echo -e " |${SrsGprofSummaryColor}gprof @see: https://github.com/winlinvip/simple-rtmp-server/wiki/GPROF\$(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)" | 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)" | 106 | @echo -e " | ${SrsGprofSummaryColor}rm -f gmon.out; ./objs/srs -c conf/srs.conf # start gprof\$(BLACK)" |
| 107 | + @echo -e " | ${SrsGprofSummaryColor}killall -2 srs # or CTRL+C to stop 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 " | ${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 " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)" |
| 109 | @echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info.\$(BLACK)" | 110 | @echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info.\$(BLACK)" |
-
请 注册 或 登录 后发表评论