1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 20:01:56 +00:00
srs/trunk/3rdparty/gprof
2014-08-01 22:43:12 +08:00
..
build_gprof2dot.sh move wiki images to srs.release 2014-03-31 11:35:00 +08:00
gprof2dot.py add gprof files and dot files 2014-03-07 16:09:35 +08:00
graphviz-2.36.0.zip use zip format 2014-03-07 17:50:21 +08:00
readme.txt slowdown the cpu usage for srs to calc connections when too many connections. 0.9.180 2014-08-01 22:43:12 +08:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

gprof图形化输出工具: gprof2dot.py graphviz-2.18.tar.gz build_gprof2dot.sh

dot:
    http://www.graphviz.org/
    http://www.graphviz.org/Download_source.php
    graphviz-2.18.tar.gz 绘图工具
    build_gprof2dot.sh 编译graphviz命令为dot。
    要求是sudoer需要sudo make install。
    
gprof2dot.py:
    将gprof的日志绘图。
    
使用方法:
0. 若需要图形化编译dot
    cd 3rdparty/gprof && bash build_gprof2dot.sh
1. srs配置时: 
    ./configure --with-gprof
    脚本会加入编译参数"-pg -lc_p"gcc -g -pg -lc_p -c xxx -o xxx.o即在configure中打开 Performance="-pg -lc_p"
    链接时,加入链接选项"-pg"否则无法工作gcc -pg -o srs xxxx.o即在configure中打开 PerformanceLink="-pg"
2. 编译和启动程序make && ./objs/srs -c conf/srs.conf
    退出程序按CTRL+C可以看到生成了gmon.out这个就是性能的统计数据。
3. gprof生成报表
    gprof -b ./objs/srs gmon.out > gprof.srs.log
4. 将报表生成图片:
    ./3rdparty/gprof/gprof2dot.py gprof.srs.log | dot -Tpng -o ~/winlin.png

缩写语句:
    # 生成 ~/winlin.log ~/winlin.png
    rm -f gmon.out; ./objs/srs -c conf/srs.conf
    # 用户按CTRL+C
    file="winlin";gprof -b ./objs/srs gmon.out > ~/${file}.log; ./3rdparty/gprof/gprof2dot.py ~/${file}.log | dot -Tpng -o ~/${file}.png

备注:
    其实gprof生成的日志就可以看不一定要图形化。
    也就是dot和gprof2dot都不用执行。
    参考http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html