Performance analysis tool first test

Performance analysis tools small scale

Description: I want to quickly know where the time-consuming procedures, but do not want a lot of statistics in each function or block of code plus time. The last two days to try the following tools.

1. perf

1.1 Installation

sudo yum install perf*

Note: This can also be used to install the source code, such as my system directory: /usr/src/kernels/3.10.0-862.el7.x86_64/tools/perf this side directly with perf

1.2

First, compile debug version of the program, such as compiling the test program, and then use the following command

perf record -g -e cpu-clock ./test test_parm1

This time the program ends normally will be automatically generated perf.data file. This file perf still need the help of view, as follows

perf report

Content is probably as follows:

1.3 summary

From the graph you can see where time is mainly consumed, but perf still looks clear enough, and the function call is not deep enough (I have not carefully studied, and possibly other parameters.)

2.valgrind

2.1 Installation

Valgrind can go to the official website http://valgrind.org/downloads/current.html download, install steps can be seen REDME, installation is very easy, I did not go wrong.

2.2

Here only the operation of generating a call graph, tool further comprising a memory check and other components, may be used in particular check the information.

For example: I have the following arguments siggle-main program, use the following command, when the program exits normally can generate callgrind.out.xxx file:

valgrind --tool=callgrind ./bin/single-main ./models/ ./data/wav_list.txt test.out

This file is then copied to the windows platform by means of graphical tools kcachegrind open, go to the official website to download: http://kcachegrind.sourceforge.net/html/Download.html

Open follows the function call, time consuming clarity:

2.3 summary

The actual gprof tool also tried, still feel valgrind easy to use them, call the main function of its relationship painted a deep, suddenly feel that this point of view kaldi source under the aid will be very convenient, ha ha.

Guess you like

Origin www.cnblogs.com/tenxi/p/11104536.html