diff options
author | Alexander Kurtakov | 2015-10-13 11:10:59 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2015-10-13 11:39:59 +0000 |
commit | 5ff78035c8026fa61dc1908c840c1b1e44b2a593 (patch) | |
tree | 251d2b60beaa8b09505e9f569908b0f09e3ec01c /perf | |
parent | f12867a3c4e4b0ade70358ba428aa0e35adc3d5e (diff) | |
download | org.eclipse.linuxtools-5ff78035c8026fa61dc1908c840c1b1e44b2a593.tar.gz org.eclipse.linuxtools-5ff78035c8026fa61dc1908c840c1b1e44b2a593.tar.xz org.eclipse.linuxtools-5ff78035c8026fa61dc1908c840c1b1e44b2a593.zip |
perf: Reduce usage of org.osgi.Version.
Version was used for parsing and comparing perf tool version but it
doesn't follow the convention thus preventing from use. This commit is
to reduce usage before replacing with another implementation.
Enable warnings for unused parameters to keep the codebase leaner.
Change-Id: Id3128a2d24a1cf29e17717afb5e5daa4de419fcf
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Reviewed-on: https://git.eclipse.org/r/58057
Tested-by: Hudson CI
Diffstat (limited to 'perf')
6 files changed, 17 insertions, 19 deletions
diff --git a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/ModelTest.java b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/ModelTest.java index bf9a8c2445..d29ce175fe 100644 --- a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/ModelTest.java +++ b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/ModelTest.java @@ -55,7 +55,6 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.Version; public class ModelTest extends AbstractTest { private ILaunchConfiguration config; @@ -348,7 +347,7 @@ public class ModelTest extends AbstractTest { tempConfig.setAttribute(PerfPlugin.ATTR_DefaultEvent, false); - String[] recordString = PerfCore.getRecordString(tempConfig, new Version(0, 0, 0)); + String[] recordString = PerfCore.getRecordString(tempConfig); assertNotNull(recordString); String[] expectedString = { PerfPlugin.PERF_COMMAND, "record", diff --git a/perf/org.eclipse.linuxtools.perf/.settings/org.eclipse.jdt.core.prefs b/perf/org.eclipse.linuxtools.perf/.settings/org.eclipse.jdt.core.prefs index b1f1d96904..e231467613 100644 --- a/perf/org.eclipse.linuxtools.perf/.settings/org.eclipse.jdt.core.prefs +++ b/perf/org.eclipse.linuxtools.perf/.settings/org.eclipse.jdt.core.prefs @@ -84,12 +84,13 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java index 3b84a0cb94..1600392fa5 100644 --- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java +++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java @@ -244,7 +244,7 @@ public class PerfCore { } //Generates a perf record command string with the options set in the given config. (If null uses default). - public static String [] getRecordString(ILaunchConfiguration config, Version perfVersion) { + public static String [] getRecordString(ILaunchConfiguration config) { String [] base = new String [] {PerfPlugin.PERF_COMMAND, "record"}; //$NON-NLS-1$ if (config == null) { return base; @@ -346,7 +346,7 @@ public class PerfCore { // Runs assuming perf.data has already been recorded, environ and workingDir can be set to null to use default //perfDataLoc is optional - it is used to provide a pre-existing data file instead of something recorded from //whatever project is being profiled. It is only used for junit tests atm. - public static void report(ILaunchConfiguration config, String[] environ, IPath workingDir, IProgressMonitor monitor, String perfDataLoc, PrintStream print) { + public static void report(ILaunchConfiguration config, IPath workingDir, IProgressMonitor monitor, String perfDataLoc, PrintStream print) { IProject project = getProject(config); TreeParent invisibleRoot = PerfPlugin.getDefault().clearModelRoot(); diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java index 191a3fad0b..d635c96c84 100644 --- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java +++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java @@ -68,7 +68,6 @@ import org.eclipse.ui.console.IConsoleManager; import org.eclipse.ui.console.IOConsole; import org.eclipse.ui.console.MessageConsole; import org.eclipse.ui.console.MessageConsoleStream; -import org.osgi.framework.Version; public class PerfLaunchConfigDelegate extends AbstractCLaunchDelegate { @@ -121,8 +120,7 @@ public class PerfLaunchConfigDelegate extends AbstractCLaunchDelegate { //Build the commandline string to run perf recording the given project String arguments[] = getProgramArgumentsArray( config ); //Program args from launch config. ArrayList<String> command = new ArrayList<>( 4 + arguments.length ); - Version perfVersion = PerfCore.getPerfVersion(config); - command.addAll(Arrays.asList(PerfCore.getRecordString(config, perfVersion))); //Get the base commandline string (with flags/options based on config) + command.addAll(Arrays.asList(PerfCore.getRecordString(config))); //Get the base commandline string (with flags/options based on config) command.add( binPath.toPortableString() ); // Add the path to the executable command.set(0, perfPathString); command.add(2,OUTPUT_STR + PerfPlugin.PERF_DEFAULT_DATA); @@ -197,7 +195,7 @@ public class PerfLaunchConfigDelegate extends AbstractCLaunchDelegate { print.println("Analysing recorded perf.data, please wait..."); //$NON-NLS-1$ //Possibly should pass this (the console reference) on to PerfCore.Report if theres anything we ever want to spit out to user. } - PerfCore.report(config, getEnvironment(config), workingDirPath, monitor, null, print); + PerfCore.report(config, workingDirPath, monitor, null, print); URI perfDataURI = null; IRemoteFileProxy proxy = null; diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfOpenData.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfOpenData.java index b9dd2bc5ee..c53f51d7fe 100644 --- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfOpenData.java +++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfOpenData.java @@ -53,7 +53,7 @@ public class PerfOpenData extends ProfileLaunchShortcut implements projectName = project.getName(); URI fileURI = ((IFile)element).getLocationURI(); ILaunchConfiguration config = createDefaultConfiguration(projectName); - PerfCore.report(config, null, null, null, fileURI.getPath(), null); + PerfCore.report(config, null, null, fileURI.getPath(), null); String timestamp = DateFormat.getInstance().format(new Date(eFile.getLocalTimeStamp())); PerfCore.refreshView(fileURI.toString() + " (" + timestamp + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -61,7 +61,7 @@ public class PerfOpenData extends ProfileLaunchShortcut implements } else { projectName = location.getProject().getName(); ILaunchConfiguration config = createDefaultConfiguration(projectName); - PerfCore.report(config, null, null, null, file.toOSString(), null); + PerfCore.report(config, null, null, file.toOSString(), null); String timestamp = DateFormat.getInstance().format(new Date(location.getLocalTimeStamp())); PerfCore.refreshView(file.toOSString() + " (" + timestamp + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfOptionsTab.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfOptionsTab.java index bd656308ec..ec111bb7d9 100644 --- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfOptionsTab.java +++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfOptionsTab.java @@ -155,8 +155,7 @@ public class PerfOptionsTab extends AbstractLaunchConfigurationTab { chkShowStat.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent se) { - Version perfVersion = PerfCore.getPerfVersion(lastConfig); - handleShowStatSelection(perfVersion); + handleShowStatSelection(); } }); statRunCount = new Spinner(showStatComp, SWT.BORDER); @@ -257,13 +256,13 @@ public class PerfOptionsTab extends AbstractLaunchConfigurationTab { /** * Handle selection of show stat button */ - private void handleShowStatSelection(Version version) { + private void handleShowStatSelection() { if (chkShowStat.getSelection()) { statRunCount.setEnabled(true); - toggleButtonsEnablement(false, version); + toggleButtonsEnablement(false); } else { statRunCount.setEnabled(false); - toggleButtonsEnablement(true, version); + toggleButtonsEnablement(true); } } @@ -301,7 +300,8 @@ public class PerfOptionsTab extends AbstractLaunchConfigurationTab { * Toggle enablement of all buttons, excluding the stat button. * @param enable enablement of buttons */ - private void toggleButtonsEnablement(boolean enable, Version version) { + private void toggleButtonsEnablement(boolean enable) { + Version version = PerfCore.getPerfVersion(lastConfig); txtKernelLocation.setEnabled(enable); chkRecordRealtime.setEnabled(enable); chkRecordVerbose.setEnabled(enable); @@ -350,7 +350,7 @@ public class PerfOptionsTab extends AbstractLaunchConfigurationTab { chkShowStat.setSelection(config.getAttribute(PerfPlugin.ATTR_ShowStat, PerfPlugin.ATTR_ShowStat_default)); int runCount = config.getAttribute(PerfPlugin.ATTR_StatRunCount, PerfPlugin.ATTR_StatRunCount_default); statRunCount.setSelection(runCount); - handleShowStatSelection(perfVersion); + handleShowStatSelection(); } catch (CoreException e) { // do nothing } |