The valgrind is a very good memory and cpu profile tool, SRS support it.
The gperf is a project of google, to analysis memory and cpu, base on tcmalloc. SRS can use gperf.
The use scenarios:
To use gmc for SRS:
./configure --with-gperf --with-gmc
make
env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf
CTRL+C
or send SIGINT to SRS.Note: When make SRS success, it will show these commands.
It work when SRS print the following message:
[winlin@dev6 srs]$ env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf
WARNING: Perftools heap leak checker is active -- Performance may suffer
The gmc report:
Leak check _main_ detected leaks of 184 bytes in 4 objects
The 4 largest leaks:
Using local file ./objs/srs.
Leak of 56 bytes in 1 objects allocated from:
@ 46fae8 _st_stack_new
@ 46f6b1 st_thread_create
@ 46ea65 st_init
@ 433f41 SrsServer::initialize
@ 46e4ca main
@ 3855a1ec5d __libc_start_main
Other examples, see research/gperftools/heap-checker
To use gmp for SRS:
./configure --with-gperf --with-gmp
make
rm -f gperf.srs.gmp*; ./objs/srs -c conf/srs.conf
CTRL+C
or send SIGINT to SRS../objs/pprof --text objs/srs gperf.srs.gmp*
Note: When make SRS success, it will show these commands.
It works when SRS show the messages:
[winlin@dev6 srs]$ ./objs/srs -c conf/srs.conf
Starting tracking the heap
The gmc result:
[winlin@dev6 srs]$ ./objs/pprof --text objs/srs gperf.srs.gmp*
Using local file objs/srs.
Using local file gperf.srs.gmp.0001.heap.
Total: 0.1 MB
0.0 31.5% 31.5% 0.0 49.1% SrsConfDirective::parse_conf
0.0 28.4% 59.9% 0.0 28.4% std::basic_string::_Rep::_S_create
0.0 27.4% 87.3% 0.0 27.4% _st_epoll_init
0.0 11.7% 99.0% 0.0 11.7% __gnu_cxx::new_allocator::allocate
0.0 0.4% 99.5% 0.0 27.9% st_init
Other examples, read research/gperftools/heap-profiler
To use gmp for SRS:
./configure --with-gperf --with-gcp
make
rm -f gperf.srs.gcp*; ./objs/srs -c conf/srs.conf
CTRL+C
or send SIGINT to SRS../objs/pprof --text objs/srs gperf.srs.gcp*
Note: When make SRS success, it will show these commands.
The gcp result:
[winlin@dev6 srs]$ ./objs/pprof --text objs/srs gperf.srs.gcp*
Using local file objs/srs.
Using local file gperf.srs.gcp.
Removing _L_unlock_16 from all stack traces.
Total: 20 samples
8 40.0% 40.0% 8 40.0% 0x00007fff0ea35917
4 20.0% 60.0% 4 20.0% __epoll_wait_nocancel
2 10.0% 70.0% 2 10.0% __read_nocancel
1 5.0% 95.0% 1 5.0% memset
1 5.0% 100.0% 1 5.0% tc_delete
0 0.0% 100.0% 5 25.0% 0x00007f9fad927c4f
0 0.0% 100.0% 2 10.0% SrsBuffer::ensure_buffer_bytes
0 0.0% 100.0% 5 25.0% SrsClient::do_cycle
0 0.0% 100.0% 5 25.0% SrsClient::fmle_publish
0 0.0% 100.0% 1 5.0% SrsClient::process_publish_message
Other examples, read research/gperftools/cpu-profiler
The conflicts:
Note: The configure of SRS will check the conflicts.
Winlin 2014.11
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。