Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Linux Tools Project/OProfile/User Guide

{{#eclipseproject:technology.linux-distros}}

Getting Started

The OProfile plug-in requires a little extra set up compared to other Eclipse plug-ins. However, it only takes a few simple steps. After the plug-in is first installed, running most profile-related commands will bring up a dialog similar to the following:


Screenshot-installscript error dialog.png


As the dialog suggests, you must run the supplied install script to allow the plug-in to perform OProfile tasks as root (since OProfile can not be run as an unprivileged user). The steps below are the same as the dialog but described in more detail.

Step 1 - Locate Plug-in Installation Directory

Open up a terminal and locate the scripts directory. The install script is located in the org.eclipse.linuxtools.oprofile.core plug-in directory, but this directory can be in a few places:

  • If you are using a distro-supplied version of Eclipse and installed the plug-in via the update site, it will most likely be under the ~/.eclipse directory, hence try the command
find ~/.eclipse -name 'org.eclipse.linuxtools.oprofile.core_*'
  • Alternatively, if you are using an extracted tarball of Eclipse (ie: you downloaded a .tar.gz from here) then the plug-in will most likely be in the plugins sub-directory of where you extracted it. Let's say you extracted the tarball to /home/ksebasti, so your Eclipse installation would be in /home/ksebasti/eclipse, then try the command
find /home/ksebasti/eclipse -name 'org.eclipse.linuxtools.oprofile.core_*'

Note that the quotes (') and asterisk (*) are necessary. Example output will look something like this:

$ find /home/ksebasti/eclipse -name 'org.eclipse.linuxtools.oprofile.core_*'
/home/ksebasti/eclipse/plugins/org.eclipse.linuxtools.oprofile.core_0.2.0.200904131051

Then, change the sub-directory natives/linux/scripts of this plug-in directory:

cd /home/ksebasti/eclipse/plugins/org.eclipse.linuxtools.oprofile.core_0.2.0.200904131051/natives/linux/scripts

Step 2 - Choose Which Installation Script To Run

In the scripts directory there are two scripts, install.sh and install-noconsolehelper.sh. Both scripts will do some sanity checks to ensure oprofile is installed and that opxml, a C++ program required to interface with OProfile, exists and can be run. The difference is in how root authentication with the plug-in is set up.

  • install.sh uses the pluggable authentication modules (PAM) mechanism. This is the default and recommended method for root authentication. When an OProfile task is required, you will be presented with this dialog to enter the root password:


Screenshot-opcontrol consolehelper.png


  • install-noconsolehelper.sh can be used when consolehelper is not present on the system, or if required PAM modules are not on the system. It uses the sudo mechanism and a small wrapper script. The install script will describe the text which should be written in the sudoers file, then run the command visudo to edit it. Note that the sudoers file is a sensitive system file and altering it in other ways may lead to system instability. Only users with enough knowledge of running a Linux system should use this method. For these reasons, this method of root authentication is discouraged. However, it may be the only option available to some users and it has been tested to work by developers and users of the plug-in.


Step 3 - Running The Install Script

Note that the install script must be run as the root user, since both install scripts have some actions which require root -- install.sh places files in /etc sub-directories and install-noconsolehelper.sh runs the command visudo. If you are not already the root user, a shortcut command can run only the install script as the root user:

su -c './install.sh'

Successful output will look like this (assuming we are in the scripts directory as in Step 2):

$ su -c './install.sh'
Eclipse-OProfile plugin install successful.

If instead you receive error messages, refer to the Troubleshooting section at the bottom of this page.

Troubleshooting

  • install script fails
  • no samples

Back to the top