|
| 1 | +Overview |
| 2 | +======== |
| 3 | + |
| 4 | +The Eclipse Callgraph plug-in provides a visual function trace of a |
| 5 | +program. This allows you to view a visualization of selected (or even |
| 6 | +all) functions used by the profiled application. |
| 7 | + |
| 8 | +This plug-in allows you to profile C/C++ projects directly within the |
| 9 | +Eclipse IDE, providing various runtime details such as: |
| 10 | + |
| 11 | +- The relationship between function calls |
| 12 | +- Number of times each function was called |
| 13 | +- Time taken by each instance of a function (relative to the program's |
| 14 | + execution time) |
| 15 | +- Time taken by all instances of a function (relative to program's |
| 16 | + execution time) |
| 17 | + |
| 18 | +Eclipse Callgraph uses SystemTap to perform function traces. For more |
| 19 | +information about SystemTap, refer to the [SystemTap Beginner's |
| 20 | +Guide](http://sources.redhat.com/systemtap/SystemTap_Beginners_Guide/). |
| 21 | + |
| 22 | +Installation |
| 23 | +============ |
| 24 | + |
| 25 | +Performing visual function traces with Eclipse Callgraph requires three |
| 26 | +components: |
| 27 | + |
| 28 | +- the Eclipse Callgraph plugins |
| 29 | +- SystemTap |
| 30 | +- the kernel information packages required by SystemTap |
| 31 | + |
| 32 | +On Fedora, you can install all of these items through **yum**. To |
| 33 | +install SystemTap, run: |
| 34 | + |
| 35 | + yum -y install systemtap systemtap-runtime |
| 36 | + |
| 37 | +The required kernel information packages are the matching **-devel**, |
| 38 | +**-debuginfo**, and **-debuginfo-common** packages of the kernel you |
| 39 | +wish to profile. You can use **yum** or **debuginfo-install** to install |
| 40 | +these packages. It is advised that you add your user-id to both the |
| 41 | +**stapdev** and **stapusr** groups. If you see error messages regarding |
| 42 | +**avahi** or if you get a message saying: "Unable to find server", this |
| 43 | +is due to your user-id not being part of the **stapdev** group. When |
| 44 | +adding your user-id to these special groups, you will need to logout and |
| 45 | +login again for the changes to take effect. |
| 46 | + |
| 47 | +For more details about installing SystemTap, refer to [Installation and |
| 48 | +Setup](http://sources.redhat.com/systemtap/SystemTap_Beginners_Guide/using-systemtap.html#using-setup) |
| 49 | +from the [SystemTap Beginner's |
| 50 | +Guide](http://sources.redhat.com/systemtap/SystemTap_Beginners_Guide/). |
| 51 | + |
| 52 | +General Usage |
| 53 | +============= |
| 54 | + |
| 55 | +All the profiling plugins (including Eclipse Callgraph) are accessible |
| 56 | +from the C/C++ perspective. There are two ways to start using Eclipse |
| 57 | +Callgraph via the **Profiling Tools** project menu: |
| 58 | + |
| 59 | +Using **Profiling Tools -> Function callgraph** |
| 60 | + |
| 61 | +<center> |
| 62 | +<img src="images/Callgraph_orig_submenu.png"> |
| 63 | + |
| 64 | +or using **Profiling Tools -> Profile Timing** and setting the timing |
| 65 | +tool to be Callgraph. |
| 66 | + |
| 67 | +<center> |
| 68 | +<img src="images/Callgraph_timing_submenu.png"> |
| 69 | + |
| 70 | +To properly set the preferences you can go to |
| 71 | +**C/C++ -> Profiling -> Categories -> Timing** and set the default timing |
| 72 | +tool to be Callgraph. |
| 73 | + |
| 74 | +<center> |
| 75 | +<img src="images/Callgraph_global_preferences.png"> |
| 76 | + |
| 77 | +Alternatively, you can set project specific preferences which override |
| 78 | +workspace preferences by using project **Properties -> C/C++ |
| 79 | +General -> Profiling Categories -> Timing**. |
| 80 | + |
| 81 | +<center> |
| 82 | +<img src="images/Callgraph_proj_preferences.png"> |
| 83 | + |
| 84 | +</center> |
| 85 | +You can also profile your application using Profile as... -> Local C/C++ |
| 86 | +Application whereby you have set the profiling tool in the Profiler tab |
| 87 | +to be Callgraph. |
| 88 | + |
| 89 | +<center> |
| 90 | +<img src="images/Callgraph_tab.png"> |
| 91 | + |
| 92 | +</center> |
| 93 | +This will open a dialog from which you can select an executable to |
| 94 | +profile. |
| 95 | + |
| 96 | +<center> |
| 97 | +<img src="images/Eclipsecallgraph-profilewhich.png"> |
| 98 | + |
| 99 | +</center> |
| 100 | +After selecting an executable to profile, Eclipse Callgraph will ask |
| 101 | +which files to probe. By default, all source files in the project will |
| 102 | +be selected. |
| 103 | + |
| 104 | +<center> |
| 105 | +<img src="images/Selectfilestoprobe.png"> |
| 106 | + |
| 107 | +Callgraph Perspectives |
| 108 | +====================== |
| 109 | + |
| 110 | +The **Callgraph** view's toolbar allows you to select a perspective and |
| 111 | +perform other functions. |
| 112 | + |
| 113 | +Radial View |
| 114 | +----------- |
| 115 | + |
| 116 | +The **Radial View** displays all functions branching out from |
| 117 | +**main()**, with each function represented as a node. A purple node |
| 118 | +means that the program terminates at the function. A green node |
| 119 | +signifies that the function call has nested functions, whereas gray |
| 120 | +nodes signify otherwise. Double-clicking on a node will show its parent |
| 121 | +(colored pink) and children. The lines connecting different nodes also |
| 122 | +display how many times **main()** called each function. |
| 123 | + |
| 124 | +<center> |
| 125 | +<img src="images/Eclipsecallgraph-radialview.png"> |
| 126 | + |
| 127 | +The left window of the **Radial View** lists all of the functions shown |
| 128 | +in the view. This window also allows you to view nested functions, if |
| 129 | +any. A green bullet point means the program either starts or terminates |
| 130 | +at that function. |
| 131 | + |
| 132 | +Tree View |
| 133 | +--------- |
| 134 | + |
| 135 | +The **Tree View** is similar to the **Radial View**, except that it only |
| 136 | +displays all descendants of a selected node (**Radial View** only |
| 137 | +displays functions one call depth away from a selected node). The top |
| 138 | +left of **Tree View** also includes a thumbnail viewer to help you |
| 139 | +navigate through different call depths of the function tree. |
| 140 | + |
| 141 | +<center> |
| 142 | +<img src="images/Eclipsecallgraph-treeview.png"> |
| 143 | + |
| 144 | +Level View |
| 145 | +---------- |
| 146 | + |
| 147 | +**Level View** displays all function calls and any nested function calls |
| 148 | +branching out from a selected node. However, **Level View** groups all |
| 149 | +functions of the same call depth together, giving a clearer |
| 150 | +visualization of a program's function call execution sequences. |
| 151 | + |
| 152 | +<center> |
| 153 | +<img src="images/Eclipsecallgraph-levelview.png"> |
| 154 | + |
| 155 | +**Level View** also lets you navigate through different call depths |
| 156 | +using the thumbnail viewer's **More nodes above** and **More nodes |
| 157 | +below** buttons. |
| 158 | + |
| 159 | +<center> |
| 160 | +<img src="images/Eclipsecallgraph-thumb.png"> |
| 161 | + |
| 162 | +Aggregate View |
| 163 | +-------------- |
| 164 | + |
| 165 | +The **Aggregate View** depicts all functions as boxes; the size of each |
| 166 | +box represents a function's execution time relative to the total running |
| 167 | +time of the program. Darker-colored boxes represent functions that are |
| 168 | +called more times relative to others; for example, in the following |
| 169 | +figure, the **CallThisThirtyTimes** function is called the most number |
| 170 | +of times (150). |
| 171 | + |
| 172 | +<center> |
| 173 | +<img src="images/Eclipsecallgraph-agg.png"> |
| 174 | + |
| 175 | +General Usage |
| 176 | +============= |
| 177 | + |
| 178 | +Most of Eclipse Callgraph's general functions are available through the |
| 179 | +**Callgraph** view's toolbar and **View Menu**. |
| 180 | + |
| 181 | +Collapse Mode |
| 182 | +------------- |
| 183 | + |
| 184 | +The **Callgraph** view's toolbar also features a **Collapse Mode** |
| 185 | +button. This button groups all identical functions (i.e. those with |
| 186 | +identical names and call histories) together into one node. Doing so can |
| 187 | +be helpful in reducing screen clutter for programs where many functions |
| 188 | +get called multiple times. |
| 189 | + |
| 190 | +<center> |
| 191 | +<img src="images/Eclipsecallgraph-collapse.png"> |
| 192 | + |
| 193 | +</center> |
| 194 | +Watching function calls in chronological order |
| 195 | +---------------------------------------------- |
| 196 | + |
| 197 | +To play a visual representation of a function trace, click the **View |
| 198 | +Menu** button then navigate to **Goto**. This menu will allow you to |
| 199 | +pause, step through, or mark each function as it executes. |
| 200 | + |
| 201 | +<center> |
| 202 | +<img src="images/Callgraph_goto_menu.png"> |
| 203 | + |
| 204 | +Code link |
| 205 | +--------- |
| 206 | + |
| 207 | +The graph views are linked to the source code as well. To navigate to |
| 208 | +where a function is called in the code, hold **Ctrl** while |
| 209 | +double-clicking on a function's node (in any view except **Aggregate |
| 210 | +View**). Doing so will open the corresponding source file in the Eclipse |
| 211 | +editor and highlight the function call. |
| 212 | + |
| 213 | +To navigate to a function's definition in the source, hold **Ctrl** |
| 214 | +while double-clicking on a function's node in the **Aggregate View**. |
| 215 | +Doing so will open the corresponding source file in the Eclipse editor |
| 216 | +and highlight the function definition. |
| 217 | + |
| 218 | +Save/load profile runs |
| 219 | +---------------------- |
| 220 | + |
| 221 | +Large projects may take longer to render; as such, Eclipse Callgraph |
| 222 | +allows you to save the data collected from a profile run. Loading the |
| 223 | +data file and attempting to render it will take a much shorter time than |
| 224 | +attempting to go through the full process of profiling a project. |
| 225 | + |
| 226 | +To save or load data from a profile run, navigate to **File** (under the |
| 227 | +**View Menu**); this will display different options relating to saving |
| 228 | +and loading profile runs. |
| 229 | + |
| 230 | +<center> |
| 231 | +<img src="images/Callgraph_file_menu.png"> |
| 232 | + |
| 233 | +</center> |
| 234 | + |
0 commit comments