You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/tools/srs-2.0-r5/trunk/3rdparty/gprof/readme.txt

1.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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<span class="ambiguous-code-point tooltip" data-content=", [U+FF0C] is confusable with , [U+002C]"><span class="char">,</span></span>命令为dot。
要求是sudoer<span class="ambiguous-code-point tooltip" data-content=", [U+FF0C] is confusable with , [U+002C]"><span class="char">,</span></span>需要sudo make install。

gprof2dot.py:
将gprof的日志绘图。

使用方法:
0. 若需要图形化<span class="ambiguous-code-point tooltip" data-content=", [U+FF0C] is confusable with , [U+002C]"><span class="char">,</span></span>编译dot<span class="ambiguous-code-point tooltip" data-content=": [U+FF1A] is confusable with : [U+003A]"><span class="char">:</span></span>
cd 3rdparty/gprof &amp;&amp; bash build_gprof2dot.sh
1. srs配置时:
./configure --with-gprof
脚本会加入编译参数&#34;-pg -lc_p&#34;<span class="ambiguous-code-point tooltip" data-content=", [U+FF0C] is confusable with , [U+002C]"><span class="char">,</span></span>gcc -g -pg -lc_p -c xxx -o xxx.o<span class="ambiguous-code-point tooltip" data-content=", [U+FF0C] is confusable with , [U+002C]"><span class="char">,</span></span>即在configure中打开 Performance=&#34;-pg -lc_p&#34;
链接时,加入链接选项&#34;-pg&#34;<span class="ambiguous-code-point tooltip" data-content=", [U+FF0C] is confusable with , [U+002C]"><span class="char">,</span></span>否则无法工作<span class="ambiguous-code-point tooltip" data-content=": [U+FF1A] is confusable with : [U+003A]"><span class="char">:</span></span>gcc -pg -o srs xxxx.o<span class="ambiguous-code-point tooltip" data-content=", [U+FF0C] is confusable with , [U+002C]"><span class="char">,</span></span>即在configure中打开 PerformanceLink=&#34;-pg&#34;
2. 编译和启动程序<span class="ambiguous-code-point tooltip" data-content=": [U+FF1A] is confusable with : [U+003A]"><span class="char">:</span></span>make &amp;&amp; ./objs/srs -c conf/srs.conf
退出程序<span class="ambiguous-code-point tooltip" data-content=", [U+FF0C] is confusable with , [U+002C]"><span class="char">,</span></span>按CTRL+C<span class="ambiguous-code-point tooltip" data-content=", [U+FF0C] is confusable with , [U+002C]"><span class="char">,</span></span>可以看到生成了gmon.out<span class="ambiguous-code-point tooltip" data-content=", [U+FF0C] is confusable with , [U+002C]"><span class="char">,</span></span>这个就是性能的统计数据。
3. gprof生成报表<span class="ambiguous-code-point tooltip" data-content=": [U+FF1A] is confusable with : [U+003A]"><span class="char">:</span></span>
gprof -b ./objs/srs gmon.out &gt; 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=&#34;winlin&#34;;gprof -b ./objs/srs gmon.out &gt; ~/${file}.log; ./3rdparty/gprof/gprof2dot.py ~/${file}.log | dot -Tpng -o ~/${file}.png

备注:
其实gprof生成的日志就可以看<span class="ambiguous-code-point tooltip" data-content=", [U+FF0C] is confusable with , [U+002C]"><span class="char">,</span></span>不一定要图形化。
也就是dot和gprof2dot都不用执行。
参考<span class="ambiguous-code-point tooltip" data-content=": [U+FF1A] is confusable with : [U+003A]"><span class="char">:</span></span>http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html