Installation and Set-Up

The easiest way to install the OProfile plug-in for Eclipse is through the Software Updates and Add-ons menu. For information on how to use this menu, refer to http://wiki.eclipse.org/Linux_Tools_Project/PluginInstallHelp#Installing_Updates_From_the_Linux_Tools_Update_Site.

Unlike most Eclipse plug-ins, the OProfile plug-in requires some configuration after installation. Note that this configuration process takes only a few simple steps, and only needs to be done once.

After the plug-in is first installed, performing a profile run with OProfile will bring up a dialog similar to the following:

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

To avoid having to perform the installation setup users can create a launch configuration for their project that uses 'operf' instead of 'opcontrol'. Simply navigate to either the Profiling/Profiling Tools launch configuration dialog and create an OProfile launch configuration. Select the OProfile Global Settings tab, and select 'operf' from the 'Profile With' combo box. In future releases, 'operf' will become the default option.

Step 1 - Locate the Installation Scripts

Open up a terminal and locate the natives/linux/scripts subdirectory, which is found in the org.eclipse.linuxtools.oprofile.core plug-in directory. The location of this plug-in directory depends on how you installed Eclipse.

Note: In both cases, the quotes (') and asterisk (*) are necessary.

Sample output will look 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

Once you find the plug-in directory, navigate to its natives/linux/scripts subdirectory. Using our previous example:

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

The natives/linux/scripts subdirectory contains the installation scripts you will need to run in order to allow OProfile to run as root.

Step 2 - Choose Which Installation Script To Run

The natives/linux/scripts subdirectory contains two scripts: install.sh, and install-noconsolehelper.sh. These scripts perform sanity checks to ensure OProfile is installed. The difference is in how root authentication with the plug-in is set up.

Step 3 - Running The Install Script

Once you have selected an install script, log in as root. Assuming you are in the natives/linux/scripts subdirectory of the plug-in directory (as in Step 1 - Locate the Installation Scripts), run your selected install script:

 # ./install.sh

Successful output will look like this:

./install.sh
Eclipse-OProfile plugin install successful.

Install scripts should be run as the root user since these scripts perform some actions that require elevated privileges: install.sh uses PolicyKit, and install-noconsolehelper.sh runs the command visudo. If you wish to simply run either install script without logging in as root, use:

 su -c './install.sh'

This command will run only the install script as the root user, then return control to the regular user. Note that you will still need to enter the root password to make this work. If you receive an error message, refer to the Troubleshooting section.

Step 4 - Restart Eclipse

After running the install script, restart Eclipse using File > Restart.

If you need to uninstall the plug-in, run the uninstall script that corresponds to the install script used. For example, if you used install.sh, you would run uninstall.sh before uninstalling it from within Eclipse. These scripts are also located in the natives/linux/scripts subdirectory of the OProfile core plug-in directory (i.e. the same directory where the install scripts are found).