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

Linux Tools Project/Profiling/User Guide

< Linux Tools Project
Revision as of 16:55, 26 September 2012 by Jjohnstn.redhat.com (Talk | contribs) (Profiling Categories)

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 set 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, the short-cut would use the memcheck tool for checking memory leaks and would set up some reasonable default parameters. Each launch short-cut results in a separate entry under the Profile as... context menu due to the 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, 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 grouped into the following task categories:

  • Time - this measure the amount of time taken in functions and methods
  • Memory - this profiles heap/stack/cache usage for an application
  • Coverage - this measures how much of the code gets exercised in a run

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.

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 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 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 under its category as a radio button as shown below. If there are no plug-ins installed for a particular category, there will be no preference page added for that category.

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 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.

Back to the top