Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Linux Tools Project/Profiling/User Guide"

(Profiling Categories)
(Introduction)
Line 10: Line 10:
 
* OProfile
 
* OProfile
 
* Perf
 
* Perf
* SystemTap (using a set script to get call-graph)
+
* SystemTap (using a systemtap script to get call-graph)
 
* Gcov (code coverage)
 
* Gcov (code coverage)
 
* GProf
 
* GProf
Line 17: Line 17:
  
 
In the past, some of the Linux Tools profiling plug-ins, such as Valgrind, would add a default launch short-cut.  The launch short-cut would use a set of default
 
In the past, some of the Linux Tools profiling plug-ins, such as Valgrind, would add a default launch short-cut.  The launch short-cut would use a set of default
parameters for the profiling tool and would launch the selected executable appropriately.  In the case of Valgrind, the short-cut would use the memcheck tool for checking
+
parameters for the profiling tool and would launch the selected executable appropriately.  In the case of Valgrind, which supports multiple tools, the short-cut would  
memory leaks and would set up some reasonable default parametersEach launch short-cut results in a separate entry under the Profile as... context menu due to the
+
default one particular tool to use (in Valgrind's case, this is the memcheck tool which checks for memory leaks)In the Eclipse Debug Launch framework, each
design of the Eclipse platform launch framework.  For example, there are short-cuts for Perf, OProfile, and Valgrind which show up as Profile With Perf, Profile With OProfile,
+
launch short-cut can specify which mode or modes it applies to (run, debug, and profile).  For those short-cuts that specify the profile mode, this results in an added
 +
menu entry under the Profile as... context menu.  For example, there are short-cuts for Perf, OProfile, and Valgrind which show up as Profile With Perf, Profile With OProfile,
 
and Profile With Valgrind, respectively.
 
and Profile With Valgrind, respectively.
  
This can be confusing to end-users who are not familiar with the various tools that are out there and what they can do.  To alleviate this, the current profiling tools have been
+
This can be confusing to end-users who are not familiar with the various tools that are out there and what they can do.  For example, both OProfile and Perf provide timing
grouped into the following task categories:
+
results for an application so there is overlap of functionality within the various tools.  To alleviate this, the current profiling tools have been
*Time - this measure the amount of time taken in functions and methods
+
grouped into task categories.  By default, there are three initial categories:
 +
*Timing - this measure the amount of time taken in functions and methods
 +
** includes Linux Tools Perf, OProfile, Callgraph (via SystemTap), and Gprof
 
*Memory - this profiles heap/stack/cache usage for an application
 
*Memory - this profiles heap/stack/cache usage for an application
 +
** includes Linux Tools Memcheck, Massif, Cachegrind, and Helgrind tools from Valgrind
 
*Coverage - this measures how much of the code gets exercised in a run
 
*Coverage - this measures how much of the code gets exercised in a run
 +
** includes Gcov
  
Future profiling tools may not fit into any of the above categories and so the mechanism has been designed to allow the addition of new categories as needed.
+
The framework is extensible and additional tools such as third-party profiling tools can be added to the basic three categories or create a new category if needed (e.g. other).
  
Each tool in a category is prioritized and the tool installed with the highest priority is the default for that category.  For example, the Perf tool has the highest
+
Each tool in a category is prioritized so when multiple tools are installed from the same category, the one with the highest priority becomes the initial default for that category.  For example, the Perf tool has the highest
priority of the profile timing tools and so is the default, if installed.  Valgrind memcheck is the default for profiling memory and Gcov is the default
+
priority of the profile timing category tools and so becomes the initial default, if installed.  Valgrind memcheck is the default for profiling memory and Gcov is the default
 
for profiling code coverage.
 
for profiling code coverage.
  
The defaults for each category can be changed via the Profiling preferences page located from the Window->Preferences menu item.  Each tool installed will show up
+
The default for any category can be set/modified by the end-user via Eclipse Preferences -> Profiling.  Each category of installed tools using the framework will present a
under its category as a radio button as shown belowIf there are no plug-ins installed for a particular category, there will be no preference page added for that
+
sub-page of the Profiling category and any tools for that category that are installed will present a radio button to choose themThe initial defaults mentioned earlier are
category.
+
only used if the user has not made a specific setting.
  
As mentioned, in the past, multiple tools would add a Profiling launch short-cut, but this is inconsistent with the Eclipse launch framework design which poses the task as
+
The following shows the Profiling Preferences page for the Timing Category with the
Profile as..., Run as..., or Debug as....  The word "as" refers to describing the executable.  For example, the CDT contributes a
+
"Local C/C++ Executable" short-cut.  There could be a remote C/C++ executable or launching a process that is running on the system.
+
The short-cuts for "Local C/C++ Executable" share parameters such as program arguments and environment variables, allowing the end-user to set these once and re-use on subsequent runs.
+
 
+
As such, the Linux Tools profiling design has been changed to add a single short-cut for "Local C/C++ Executable" and to use the program arguments and environment variables from any Run or Debug
+
launch profile for that executable that has the same name. 
+
 
+
With only one short-cut provided, there must be a single tool defaulted.  As such, the default category to use is an option in the Profiling preferences page.  Again, a radio button
+
style interface is presented with all categories installed being shown.  Without intervention, Profile Time is the default as most users are concerned with how much time their application
+
uses and how this is broken up within the application.
+
 
+
In the 'Preferences' dialog, under the 'Profiling' category is a list of the supported categories currently contributed by Linux Tools plug-ins.
+
Each category creates a Preference page that has a set of radio buttons for each of the contributed profiling short-cuts.  The first time opening this page
+
will have the default selected.  If there is more than one choice, the end-user may select whatever profiling short-cut is desired.
+
 
+
For example, the default for Memory profiling is using the Valgrind Memcheck tool which validates heap function calls (e.g. finds memory leaks and
+
invalid usage of freed memory).  An end-user may rather default memory profiling to use the Valgrind Massif tool which simply tracks heap usage
+
for the lifetime of the application.
+

Revision as of 15:16, 5 October 2012

Introduction

The Linux Tools project provides Eclipse interfaces to a number of system tools sufficient to profile a C/C++ application. For example, the Valgrind plug-in provides the ability to profile an application's memory usage while the Perf plug-in allows an end-user to acquire details regarding the amount of time taken in various functions or methods. From the user point-of-view, the user wants to profile a C/C++ executable and this is available via the Profile as.. right-click context menu or via the Profile Configurations... dialog or via the Profile button found next to the Debug and Run buttons at the top of the Eclipse Window.

Support exists for:

  • Valgrind (memcheck, massif, cachegrind, and helgrind sub-tools)
  • OProfile
  • Perf
  • SystemTap (using a systemtap script to get call-graph)
  • Gcov (code coverage)
  • GProf

Profiling Categories

In the past, some of the Linux Tools profiling plug-ins, such as Valgrind, would add a default launch short-cut. The launch short-cut would use a set of default parameters for the profiling tool and would launch the selected executable appropriately. In the case of Valgrind, which supports multiple tools, the short-cut would default one particular tool to use (in Valgrind's case, this is the memcheck tool which checks for memory leaks). In the Eclipse Debug Launch framework, each launch short-cut can specify which mode or modes it applies to (run, debug, and profile). For those short-cuts that specify the profile mode, this results in an added menu entry under the Profile as... context menu. For example, there are short-cuts for Perf, OProfile, and Valgrind which show up as Profile With Perf, Profile With OProfile, and Profile With Valgrind, respectively.

This can be confusing to end-users who are not familiar with the various tools that are out there and what they can do. For example, both OProfile and Perf provide timing results for an application so there is overlap of functionality within the various tools. To alleviate this, the current profiling tools have been grouped into task categories. By default, there are three initial categories:

  • Timing - this measure the amount of time taken in functions and methods
    • includes Linux Tools Perf, OProfile, Callgraph (via SystemTap), and Gprof
  • Memory - this profiles heap/stack/cache usage for an application
    • includes Linux Tools Memcheck, Massif, Cachegrind, and Helgrind tools from Valgrind
  • Coverage - this measures how much of the code gets exercised in a run
    • includes Gcov

The framework is extensible and additional tools such as third-party profiling tools can be added to the basic three categories or create a new category if needed (e.g. other).

Each tool in a category is prioritized so when multiple tools are installed from the same category, the one with the highest priority becomes the initial default for that category. For example, the Perf tool has the highest priority of the profile timing category tools and so becomes the initial default, if installed. Valgrind memcheck is the default for profiling memory and Gcov is the default for profiling code coverage.

The default for any category can be set/modified by the end-user via Eclipse Preferences -> Profiling. Each category of installed tools using the framework will present a sub-page of the Profiling category and any tools for that category that are installed will present a radio button to choose them. The initial defaults mentioned earlier are only used if the user has not made a specific setting.

The following shows the Profiling Preferences page for the Timing Category with the

Back to the top