Xprofiler lets you look at your profiled data a number of ways, depending on what you want to see. It provides:
Xprofiler lets you magnify specific areas of the window to get a better view of your profiled data. The View menu includes three options that let you do this:
To resize a specific area of the display, you can use either the Overview or Zoom In options of the View menu. To magnify an area with the Overview option:
Figure 10. The Overview Window
View figure.
The Overview Window contains a miniature view of the function call tree, just as it appears in the Xprofiler main display. When you open the Overview Window, the light blue highlight area represents the current view of the main window.
You control the size and placement of the highlight area with your mouse. Depending on where you place your mouse over the highlight area, your cursor changes to indicate the operation you can perform. Here is an explanation of the cursor images, and what they indicate to you:
When your cursor appears as two crossed arrows, it means that by pressing and holding your mouse button, you can control where the box is placed.
Figure 11. Cursor when movement of highlight box is under mouse control
View figure.
When your cursor appears as a line with an arrow perpendicular to it, it means that your mouse button has grabbed the edge of the highlight area, and you now have the ability to resize it. By pressing and holding your mouse button, and dragging it in or out, you can increase or decrease the size of the box. Notice that as you move the edge in or out, the size of the entire highlight area changes.
Figure 12. Cursor when edge of highlight box is under mouse control
View figure.
When your cursor appears as a right angle with an arrow pointing into it, it means that your mouse button has grabbed the corner of the highlight area and you now have the ability to resize it. By pressing and holding your mouse button, and dragging it diagonally up or down, you can increase or decrease the size of the box. Notice that as you move the corner up or down, the size of the entire highlight area changes.
Figure 13. Cursor when corner of highlight box is under mouse control
View figure.
Figure 14. Highlight Area Reduced in Size
View figure.
The example below shows the Xprofiler main display with the area, indicated by the highlight area in Figure 14, magnified. Note that the performance data, on the label of each function box, is now visible.
Figure 15. Magnified View of Xprofiler Display
View figure.
To use the Zoom In option of the View menu to magnify a specific area of the function call tree:
To get an even closer view of the area you selected, choose the Zoom In option again and follow the steps above.
There may be times when you are looking at the function call tree too closely. The Zoom Out option lets you widen the view of the function call tree, as if you were taking a few steps back from a painting on a wall.
The Zoom Out option is most useful after using the Zoom In or Overview options to magnify an area of the function call tree. By default, the Xprofiler main window is completely zoomed out (it shows you the entire function call tree). The Zoom Out option helps you return the main window to this state.
To zoom out:
To further step back from the area you selected, choose the Zoom Out option again, and follow the steps above.
The Utility menu of the Overview window lets you choose the mode in which the display is updated. The default is the Immediate Update option, which causes the display to show you the items in the highlight area as you are moving it around. The Delayed Update option, on the other hand, causes the display to be updated only when you have moved the highlight area over the area in which you are interested, and released the mouse button. The Immediate Update option only applies to what you see when you move the highlight area; it has no effect on the resizing of items in highlight area, which is always delayed.
Xprofiler lets you change the way it displays the function call tree, based on your own personal preferences.
You can choose between 2-D and 3-D function boxes in the function call tree. The default style is 2-D, but you can change this to 3-D. To do this:
You can choose to have Xprofiler display the function call tree in either Top-to-Bottom or Left-to-Right format. The default is Top-to-Bottom. If you would rather see the function call tree displayed in Left-to-Right format:
Figure 16. Left-to-Right Format
View figure.
You can choose to have Xprofiler represent the function call tree in either summary mode or average mode.
When you select the Summary Mode option of the View menu, the size and shape of each function box is determined by the total CPU time of multiple gmon.out files used on that function alone, and the total time used by the function and its descendant functions. The height of each function node represents the total CPU time used on the function itself. The width of each node represents the total CPU time used on the function and its descendant functions. When the display is in summary mode, the Summary Mode option is greyed out and the Average Mode option is activated.
When you select the Average Mode option of the View menu, the size and shape of each function box is determined by the average CPU time used on that function alone, among all loaded gmon.out files, and the standard deviation of CPU time for that function among all loaded gmon.out files. The height of each function node represents the average CPU time, among all the input gmon.out files, used on the function itself. The width of each node represents the standard deviation of CPU time, among the gmon.out files, used on the function itself.
The purpose of average mode is to reveal workload balancing problems when an application is involved with multiple gmon.out files. In general, a function node with large standard deviation has a wide width, and a node with small standard deviation has a slim width.
Both summary mode and average mode only affect the appearance of the function call tree and the labels associated with it. All the performance data in Xprofiler reports and code displays are always summary data. If only one gmon.out file is given, both Summary Mode and Average Mode will be greyed out, and the display is always in Summary Mode.
When Xprofiler first opens, the entire function call tree appears in the main window. This includes the function boxes and call arcs that belong to your executable as well as the shared libraries that it utilizes. At times, you may want to simplify what you see in the main window, and there are a number of ways to do this.
Xprofiler allows you to undo operations that involve adding or removing nodes and arcs from the function call tree. When you undo an operation, you reverse the effect of any operation which adds or removes function boxes or call arcs to the function call tree. When you select the Undo option, the function call tree is returned to its appearance just prior to the performance of the add or remove operation. To undo an operation:
Whenever you invoke the Undo option, the function call tree loses its zoom focus and zooms all the way out to reveal the entire function call tree in the main display. When you start Xprofiler, the Undo option is greyed out. It is activated only after an add or remove operation involving the function call tree takes place. After you undo an operation, the option greys out again until the next add or remove operation takes place.
The options that activate the Undo option include:
If a dialog, like the Load Configuration Dialog or the Filter by CPU Time Dialog, is invoked and then cancelled immediately, the status of the Undo option is not affected. Once the option is available, it stays that way until you invoke it, or a new set of files is loaded into Xprofiler through the Load Files Dialog.
When you first open Xprofiler, by default, all the function boxes and call arcs of your executable and its shared libraries appear in the main window. After that, you may choose to filter out specific items from the window. However, there may be times when you want to see the entire function call tree again, without having to reload your application. To do this:
There are a number of ways that Xprofiler lets you control the items that get displayed in the main window. For the most part, you will want to include or exclude certain objects so that you can more easily focus on the things that are of most interest to you.
In most cases, your application will call functions that are within shared libraries. By default, these shared libraries will appear in the Xprofiler window along with your executable. As a result, the window may get crowded and obscure the items that you really want to see. If this is the case, you may want to filter the shared libraries from the display. To do this:
The shared library function boxes disappear from the function call tree, leaving only the function boxes of your executable file visible.
If you removed the library calls from the display, you may want to add all or some of them back. To do this:
The function boxes once again appear with the function call tree. Note, however, that all of the shared library calls that were in the initial function call tree may not be added back. This is because the Add Library Calls option only adds back in the function boxes for the library functions that were called by functions that are currently displayed in the Xprofiler window.
There may be times when you want to add only specific function boxes back into the display. To do this:
If there are multiple functions in your program that include the string you enter in their names, the filter applies to each one. For example, say you specified sub, and print, and your program also included functions named sub1, psub1 and printf. The sub, sub1, psub1, print, and printf functions would all be added to the graph.
The Filter menu of Xprofiler offers you three options that allow you to add or subtract function boxes from the main window, based on specific characteristics. The options are:
Each one of these options uses a different dialog window to let you specify the criteria by which you want to include or exclude function boxes from the window.
To filter by function names:
Figure 17. Filter By Function Names Dialog window
View figure.
From the Filter By Function Names Dialog window, select the option you want, and then type the name of the function(s) to which you want it applied in the Enter function name field. For example, say you wanted to remove function box for a function called printf, from the main window. You would click on the remove this function from the graph button and type printf in the Enter function name field.
You can enter more than one function name in this field. If there are multiple functions in your program that include the string you enter in their names, the filter will apply to each one. For example, say you specified sub and print, and your program also included functions named sub1, psub1, and printf. The option you chose would be applied to the sub, sub1, psub1, print, and printf functions.
To filter by CPU time:
Figure 18. Filter By CPU Time Dialog window
View figure.
For example, if you wanted to display the function boxes for the 10 functions in your application that consumed the most CPU, you would select the show functions consuming the most CPU button, and specify 10 with the slider or enter the value 10 in the text field.
To filter by call counts:
Figure 19. Filter By Call Counts Dialog window
View figure.
For example, if you wanted to display the 10 call arcs in your application that represented the least number of calls, you would select the show arcs with the least call counts button, and specify 10 with the slider or enter the value 10 in the text field.
When tuning the performance of your application, you will want to know which functions consumed the most CPU time, and then you will need to ask several questions in order to understand their behavior:
Once you understand how these functions behave, and are able to improve their performance, you can move on to analyzing the functions that consume less CPU.
When your application is large, the function call tree will also be large. As a result, the functions that are the most CPU-intensive may be difficult to see in the function call tree. To get around this, use the Filter by CPU option of the Filter menu, which lets you display only the function boxes for the functions that consume the most CPU time. Once you've done this, the Function menu for each function lets you add the parent and descendant function boxes to the function call tree. By doing this, you create a smaller, simpler function call tree that displays the function boxes associated with most CPU-intensive area of the application.
A child function is one that is directly called by the function of interest. To see only the function boxes for the function of interest and its child functions:
Xprofiler erases the current display and replaces it with only the function boxes for the function you chose, plus its child functions.
A parent function is one that directly calls the function of interest. To see only the function box for the function of interest and its parent functions:
Xprofiler erases the current display and replaces it with only the function boxes for the function you chose, plus its parent functions.
There may be times when you may want to see the function boxes for both the parent and child functions of the function in which you are interested, without erasing the rest of the function call tree. This is especially true if you chose to display the function boxes for two or more of the most CPU-intensive functions with the Filter by CPU option of the Filter menu (you suspect that more than one function is consuming too much CPU). To do this:
Xprofiler leaves the current display as it is, but adds the parent function boxes.
Xprofiler leaves the current display as it is, but now adds the child function boxes in addition to the parents.
When you first bring up the Xprofiler window, by default, the function boxes of your executable, and the libraries associated with it, are clustered. Since Xprofiler shrinks the call tree of each library when it places it in a cluster, you will need to uncluster the function boxes if you want to look closely at a specific function box label.
It is important to understand that you can see significantly more detail per function, when your display is in the unclustered or expanded state, than when it is in the clustered or collapsed state. So, depending on what you want to do, you will need to cluster or uncluster (collapse or expand) the display.
There may be times when the Xprofiler window is visually crowded. This is especially true if your application calls functions that are within shared libraries; function boxes representing your executable functions as well as the functions of the shared libraries get displayed. As a result, you may want to organize what you see in the Xprofiler window so you can focus on the areas that are most important to you. One way you can do this is to collect all the function boxes of each library into a single area, known as a library cluster.
When you choose to cluster your libraries, Xprofiler gathers all the functions for each one into a single area, and draws a green box around them. This is known as a cluster box. The name of the library also appears below the box.
The function boxes in the application shown in Figure 7 have been clustered. Note that one cluster box holds the function boxes associated with the executable hello_world, while the other cluster box holds the function boxes of the shared library /lib/profiled/libc.a:shr.o.
The example below shows the same application, hello_world, with its function boxes unclustered. Now that the function boxes of your executable and its shared libraries are displayed together, which means their relationships are more apparent.
Figure 20. Xprofiler Window with Function Boxes Unclustered
View figure.
If the functions within your application are unclustered, you can use an option of the Filter menu to cluster them.
Once you cluster the functions in your application, as shown in Figure 7, you can further reduce the size (also referred to as collapse) of each cluster box. To do this:
Figure 21. Xprofiler Window with One Library Cluster Box Collapsed
View figure.
To return the cluster box to its original condition (expand it):
If the functions within your application are clustered, you can use an option of the Filter menu to uncluster them.
If your functions have been clustered, you may want to remove one or more (but not all) cluster boxes. For example, say you wanted to uncluster only the functions of your executable, but keep its shared libraries within their cluster boxes. You would:
The example below shows the executable, hello_world with its cluster box removed. Its shared library, /lib/profiled/libc.a:shr.o, remains within its cluster box.
Figure 22. Xprofiler Window with One Library Cluster Box Removed
View figure.
If you are interested in one or more specific functions in a complex program, you may need help locating their corresponding function boxes in the function call tree.
If you would like to locate a single function, and you know its name, you can use the Locate Function By Name option of the Utility menu. To locate a function by name:
To display the function call tree in full detail again, go to the View menu and use the Overview option.
There may also be times when you want to see only the function boxes for the functions you are concerned with, plus other specific functions that are related to it. For instance, suppose you want to see all the functions that directly called the function in which you are interested. It might not be easy to pick out these function boxes when you view the entire call tree, so you would want to display them, plus the function of interest, alone.
Each function has its own menu, called a Function menu. Via the Function menu, you can choose to see the following for the function in which you are interested:
When you use these options, Xprofiler erases the current display and replaces it with only the function boxes for the function of interest and all the functions of the type you specified.
A parent is any function that directly calls the function in which you are interested. To locate the parent function boxes of the function in which you are interested:
A child is any function that is directly called by the function in which you are interested. To locate the child functions boxes for the function in which you are interested:
An ancestor is any function that can call, directly or indirectly, the function in which you are interested. To locate the ancestor functions:
A descendant is any function that can be called, directly or indirectly, by the function in which you are interested. To locate the descendant functions (all the functions that the function of interest can reach, directly or indirectly):
To locate the functions that are on the same cycle as the function you are interested in: