Skip to content

Commit fd3be71

Browse files
authored
Upload new gprof user guide
1 parent 012ff84 commit fd3be71

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

GPROF_USER_GUIDE

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
Overview
2+
========
3+
4+
The Gprof plugin allows to visualize in eclipse gprof's output (aka gmon.out).
5+
6+
For more details on gprof, visit the GNU Gprof documentation at <http://sourceware.org/binutils/docs-2.20/gprof/index.html> .
7+
8+
Installation and Set-Up
9+
=======================
10+
11+
Gprof plugin depends on binutils (such as addr2line, c++filt and nm). Gprof can be used on any platform as soon as these binutils are in PATH. For example, you can use it on windows with cygwin.
12+
13+
Older version Configuration pre 3.2.0
14+
-------------------------------------
15+
16+
First of all, the user has to compile the C/C++ program with profiling enabled using the -pg option prior to running the tool. This can be done via the project Properties-\>C/C++ Build-\>Settings-\>Tool Settings-\>GCC C Compiler-\>Debugging tab which has a check-box "Generate Gprof Information (-pg)". A similar check-box can be used for CDT Autotools projects. It is found under project Properties-\>Autotools-\>Configure Settings-\>configure-\>Advanced.
17+
18+
![](images/LinuxtoolsGprofBuildConsole.png "images/LinuxtoolsGprofBuildConsole.png")
19+
20+
Newer Version Configuration 3.2.\* onwards
21+
------------------------------------------
22+
23+
When the user tires to run gprof for the first time, the user will be asked if he would like eclipse to enable gprof for the user automatically.
24+
25+
This will enable the debug checkbox 'Generate gprof information (-pg)' in the setting shown in the following screenshot:
26+
27+
[none ](File:images/GProfSettings_page_2014.07.17.png "wikilink")
28+
29+
After which the tool will start and generate a new view as the output.
30+
31+
Supported format
32+
================
33+
34+
Up to now, the Gprof plugin supports gmon files generated on:
35+
36+
- linux (ELF) 32 bits
37+
- linux (ELF) 64 bits
38+
- cygwin and BSD: support is not yet complete. See <https://bugs.eclipse.org/bugs/show_bug.cgi?id=333984>
39+
- powerpc: ongoing. See <https://bugs.eclipse.org/bugs/show_bug.cgi?id=351355>
40+
41+
Opening gmon.out
42+
================
43+
44+
Once the application run is finished, a gmon.out file is generated under the project.
45+
46+
![](images/LinuxToolsGprofGmonOut.png "images/LinuxToolsGprofGmonOut.png")
47+
48+
Double clicking on this file will open a dialog to select the associated binary.
49+
50+
![](images/LinuxToolsGprofDialog.png "images/LinuxToolsGprofDialog.png")
51+
52+
Profiling Using GProf
53+
=====================
54+
55+
Instead of running the application and double-clicking the gmon.out file, you can also just profile the application using the gprof plug-in. This will run the application and display the results for you. To profile using gprof, you can use Profiling Tools-\>Profile Timing and set the timing tool to be gprof.
56+
57+
![](images/LinuxToolsGprofTiming.png "images/LinuxToolsGprofTiming.png")
58+
59+
In preferences, you can also go to: C/C++-\>Profiling-\>Categories-\>Timing and set the default timing tool to be gprof.
60+
61+
![](images/LinuxToolsTimingPreferencesGprof.png "images/LinuxToolsTimingPreferencesGprof.png")
62+
63+
or for a project, you can override the workspace preference default using project Properties-\>C/C++ General-\>Profiling Categories-\>Timing
64+
65+
![](images/LinuxToolsTimingPropertiesGprof.png "images/LinuxToolsTimingPropertiesGprof.png")
66+
67+
You can also profile your application using Profile as...-\>Local C/C++ Application whereby you have set the profiling tool in the Profiler tab to be gprof.
68+
69+
![](images/LinuxToolsProfileLocalGprof.png "images/LinuxToolsProfileLocalGprof.png")
70+
71+
GProf View
72+
==========
73+
74+
The Gprof view shows which parts of the program consume most of the execution time. It also provides call graph infomation for each function.
75+
76+
![](images/LinuxToolsGprofView.png "fig:images/LinuxToolsGprofView.png")
77+
78+
Several buttons are available in the toolbar.
79+
80+
- ![](images/Gprof-export-to-csv.gif "fig:images/Gprof-export-to-csv.gif") : "Export to CSV" button allows you to export the gprof result as a CSV text file, suitable for any spreadsheet.
81+
- ![](images/Gprof-sort-per-file.gif "fig:images/Gprof-sort-per-file.gif") : "Sort samples per file" button displays gprof result sorted by file.
82+
- ![](images/Gprof-sort-per-function.gif "fig:images/Gprof-sort-per-function.gif") : "Sort samples per function" button displays gprof result sorted by function.
83+
- ![](images/Gprof-sort-per-line.gif "fig:images/Gprof-sort-per-line.gif") : "Sort samples per line" button displays gprof result sorted by line.
84+
- ![](images/Gprof-display-call-graph.png "fig:images/Gprof-display-call-graph.png") : "Display function call graph" button displays gprof result as a call graph.
85+
86+
- ![](images/Gprof-sample-time.gif "fig:images/Gprof-sample-time.gif") : "Switch samples/time" button allows you to switch result display from samples to time and vice-versa.
87+
- ![](images/Gprof-birt-chart.gif "fig:images/Gprof-birt-chart.gif") : "Create Chart..." button allows you to create a BIRT chart, with the current lines selected in the gprof result view.
88+
89+
If program is compiled with debug option (e.g. "-g"), double-clicking on a item in the result will open the corresponding source location.
90+
91+
Troubleshooting
92+
===============
93+
94+
If you encounter a problem with the gprof plugin, please open an issue: <https://github.com/eclipse-linuxtools/org.eclipse.linuxtools/issues/new/choose>

0 commit comments

Comments
 (0)