forked from qt-creator/qt-creator
Doc: Valgrind Memcheck changed and Callgrind added
Change-Id: I557e268f8d000f6f53672d0a5f8957672858dbe1 Reviewed-on: http://codereview.qt.nokia.com/779 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
BIN
doc/images/analyzer-issues.png
Normal file
BIN
doc/images/analyzer-issues.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
BIN
doc/images/qtcreator-analyze-menu.png
Normal file
BIN
doc/images/qtcreator-analyze-menu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
doc/images/qtcreator-valgrind-callgrind-options.png
Normal file
BIN
doc/images/qtcreator-valgrind-callgrind-options.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
doc/images/qtcreator-valgrind-callgrind.png
Normal file
BIN
doc/images/qtcreator-valgrind-callgrind.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
BIN
doc/images/qtcreator-valgrind-memcheck-options.png
Normal file
BIN
doc/images/qtcreator-valgrind-memcheck-options.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -132,6 +132,7 @@
|
||||
\list
|
||||
\o \l{Profiling QML Applications}
|
||||
\o \l{Detecting Memory Leaks}
|
||||
\o \l{Profiling Function Execution}
|
||||
\endlist
|
||||
\o \l{Deploying Applications to Mobile Devices}
|
||||
\list
|
||||
@@ -445,7 +446,8 @@
|
||||
|
||||
The memory available on devices is limited and you should use it carefully.
|
||||
Qt Creator integrates Valgrind code analysis tools for detecting memory
|
||||
leaks and profiling cache usage. These tools are only supported on Linux and
|
||||
leaks and profiling function execution. These tools are only supported on
|
||||
Linux and
|
||||
Mac OS. You must download and install them separately to use them from Qt
|
||||
Creator.
|
||||
|
||||
@@ -5098,7 +5100,7 @@
|
||||
|
||||
/*!
|
||||
\contentspage index.html
|
||||
\previouspage creator-troubleshooting-debugging.html
|
||||
\previouspage creator-cache-profiler.html
|
||||
\page creator-deployment.html
|
||||
\nextpage creator-deployment-symbian.html
|
||||
|
||||
@@ -12037,9 +12039,9 @@
|
||||
|
||||
/*!
|
||||
\contentspage index.html
|
||||
\previouspage creator-debugging-qml.html
|
||||
\previouspage creator-qml-performance-monitor.html
|
||||
\page creator-analyzer.html
|
||||
\nextpage creator-troubleshooting-debugging.html
|
||||
\nextpage creator-cache-profiler.html
|
||||
|
||||
\title Detecting Memory Leaks
|
||||
|
||||
@@ -12049,19 +12051,176 @@
|
||||
|
||||
\note Memcheck is supported on Linux and Mac OS.
|
||||
|
||||
After you download and install Memcheck, you can use it from Qt Creator.
|
||||
To analyze applications, select \gui {Debug > Start Analyzer > Start}.
|
||||
After you download and install Valgrind tools, you can use Memcheck from Qt
|
||||
Creator.
|
||||
To analyze applications:
|
||||
|
||||
\list 1
|
||||
|
||||
\o In the \gui Projects mode, select a release build configuration.
|
||||
|
||||
\o Select \gui Analyze to open the \gui Analyze mode.
|
||||
|
||||
\o Select \gui {Analyze Memory} on the toolbar.
|
||||
|
||||
\o Select the
|
||||
\inlineimage qtcreator-analyze-start-button.png "Start button"
|
||||
button to start the application.
|
||||
|
||||
\o Use the application to analyze it.
|
||||
|
||||
\o Select the
|
||||
\inlineimage qtcreator-analyzer-stop-button.png "Stop button"
|
||||
button to view the results of the analysis in the
|
||||
\gui {Analysis} view.
|
||||
|
||||
\endlist
|
||||
|
||||
While the application is running, Memcheck checks all reads and writes of
|
||||
memory and intercepts calls that allocate or free memory or create or
|
||||
delete memory blocks.
|
||||
delete memory blocks. When you stop Memcheck, it displays the results in
|
||||
the \gui Analysis output pane. Click a line to view where a memory leak
|
||||
occurred and a stack trace that shows what caused it.
|
||||
|
||||
\image analyzer-issues.png "Analysis view"
|
||||
|
||||
Move the mouse on on a row to view more information about the function.
|
||||
|
||||
For more information about using Memcheck, see
|
||||
\l{http://valgrind.org/docs/manual/quick-start.html#quick-start.mcrun}
|
||||
{Interpreting Memcheck's Output} in the Valgrind documentation.
|
||||
|
||||
\section1 Selecting Options for Memory Analysis
|
||||
|
||||
Stack traces can get quite large and confusing, and therefore, reading them
|
||||
from the bottom up can help. If the stack trace is not big enough or it is
|
||||
too big, select \gui {Tools > Options... > Analyzer > Memory Analysis}.
|
||||
Define the length of the stack trace in the \gui {Backtrace frame count}
|
||||
field.
|
||||
|
||||
Memcheck also reports uses of uninitialised values, most commonly with the
|
||||
message \gui {Conditional jump or move depends on uninitialised value(s).}
|
||||
To determine the root cause of these errors, the \gui {Track origins of
|
||||
uninitialized memory} check box is selected by default. This makes Memcheck
|
||||
run slower, but the extra information you get often saves a lot of time
|
||||
figuring out where the uninitialised values are coming from.
|
||||
|
||||
Memcheck detects numerous problems in the system libraries, such as the C
|
||||
library, which come pre-installed with your OS. As you cannot easily fix
|
||||
them, you want to suppress them. Valgrind reads a list of errors to suppress
|
||||
at startup. A default suppression file is created by the ./configure script
|
||||
when the system is built.
|
||||
|
||||
You can write your own suppression files if parts of your project contain
|
||||
errors you cannot fix and you do not want to be reminded of them. Click
|
||||
\gui Add in the \gui {Memory Analysis} dialog to add the suppression files.
|
||||
For more information about writing suppression files, see
|
||||
\l{http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress}
|
||||
{Suppressing Errors} in the Valgrind documentation.
|
||||
|
||||
\image qtcreator-valgrind-memcheck-options.png "Memory Analysis options"
|
||||
|
||||
If problems are found, they are listed in the \gui Analysis output pane.
|
||||
Select a link to move to the problematic code.
|
||||
|
||||
\image analyzer_issues.png "Analysis output pane"
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\contentspage index.html
|
||||
\previouspage creator-analyzer.html
|
||||
\page creator-cache-profiler.html
|
||||
\nextpage creator-deployment.html
|
||||
|
||||
\title Profiling Function Execution
|
||||
|
||||
You can use the Callgrind tool included in the
|
||||
\l{http://valgrind.org/info/tools.html}{Valgrind tool suite} to detect
|
||||
problems that are related to cache usage.
|
||||
|
||||
After you download and install Valgrind tools, you can use Callgrind from Qt
|
||||
Creator.
|
||||
To analyze applications:
|
||||
|
||||
\list 1
|
||||
|
||||
\o In the \gui Projects mode, select a release build configuration.
|
||||
|
||||
\o Select \gui Analyze to open the \gui Analyze mode.
|
||||
|
||||
\o Select \gui Profile on the toolbar.
|
||||
|
||||
\o Select the
|
||||
\inlineimage qtcreator-analyze-start-button.png "Start button"
|
||||
button to start the application.
|
||||
|
||||
\o Use the application to analyze it.
|
||||
|
||||
\o Select the
|
||||
\inlineimage qtcreator-analyzer-stop-button.png "Stop button"
|
||||
button to view the results of the analysis in the \gui Profile
|
||||
view.
|
||||
|
||||
\endlist
|
||||
|
||||
Callgrind records the call history of functions that are executed when the
|
||||
application is run. It collects the number of instructions that are
|
||||
executed, their relationship to source lines, the relationships of the
|
||||
caller and callee between functions, and the numbers of such calls. You can
|
||||
also use cache simulation or branch prediction to gather information about
|
||||
the runtime behavior of an application.
|
||||
|
||||
Double-click a function to view information about the calling functions in
|
||||
the \gui Callers view and about the called functions in the \gui Callees
|
||||
view.
|
||||
|
||||
\image qtcreator-valgrind-callgrind.png "Profile view"
|
||||
|
||||
\section1 Selecting Profiling Options
|
||||
|
||||
To specify settings for Callgrind, select \gui {Tools > Options... >
|
||||
Analyzer > Profiling}.
|
||||
|
||||
\image qtcreator-valgrind-callgrind-options.png "Profiling options"
|
||||
|
||||
In the \gui {Result view: Show events with inclusive costs higher than}
|
||||
field, limit the amount of results the profiler gives you to increase
|
||||
profiler performance.
|
||||
|
||||
You can collect information about the system call times and the number of
|
||||
global bus events of the event type \c Ge that are executed.
|
||||
|
||||
\section2 Enabling Full Cache Simulation
|
||||
|
||||
By default, only instruction read accesses (Ir) are counted. To fully
|
||||
simulate the cache, select the \gui {Enable cache simulation} check box.
|
||||
This enables the following additional event counters:
|
||||
|
||||
\list
|
||||
|
||||
\o Cache misses on instruction reads (I1mr/I2mr)
|
||||
|
||||
\o Data read accesses (Dr) and related cache misses (D1mr/D2mr)
|
||||
|
||||
\o Data write accesses (Dw) and related cache misses (D1mw/D2mw)
|
||||
|
||||
\endlist
|
||||
|
||||
\section2 Enabling Branch Prediction Simulation
|
||||
|
||||
To enable the following additional event counters, select the
|
||||
\gui {Enable branch prediction simulation} check box:
|
||||
|
||||
\list
|
||||
|
||||
\o Number of conditional branches executed and related predictor misses
|
||||
(Bc/Bcm)
|
||||
|
||||
\o Executed indirect jumps and related misses of the jump address
|
||||
predictor (Bi/Bim)
|
||||
|
||||
\endlist
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\contentspage index.html
|
||||
@@ -12165,7 +12324,8 @@
|
||||
identifying potential bottlenecks, especially in the evaluation of bindings.
|
||||
|
||||
In addition, Qt Creator integrates Valgrind code analysis tools for
|
||||
detecting memory leaks and profiling cache usage. These tools are only
|
||||
detecting memory leaks and profiling function execution. These tools are
|
||||
only
|
||||
supported on Linux and Mac OS. You have to download and install them
|
||||
separately to use them from Qt Creator.
|
||||
|
||||
@@ -12173,6 +12333,8 @@
|
||||
\gui {Debug > Start Analyzer} menu. In \gui Analyze mode, you can switch
|
||||
between tools by selecting them in the menu on the toolbar.
|
||||
|
||||
\image qtcreator-analyze-menu "Analyze mode menu"
|
||||
|
||||
To run the Valgrind tools on a remote device over SSH, select \gui {Debug >
|
||||
Start Analyzer > Start Remote}.
|
||||
|
||||
@@ -12193,7 +12355,7 @@
|
||||
\o \l{Detecting Memory Leaks} describes how to use the Valgrind
|
||||
Memcheck tool to detect problems in memory management.
|
||||
|
||||
\o \l{Profiling Cache} describes how to use the Valgrind Callgrind
|
||||
\o \l{Profiling Function Execution} describes how to use the Valgrind Callgrind
|
||||
tool to find cache misses in the code.
|
||||
|
||||
\endlist
|
||||
|
||||
Reference in New Issue
Block a user