diff options
Diffstat (limited to 'profiling')
13 files changed, 374 insertions, 2 deletions
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF b/profiling/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF index 5eb1196502..173f1bca77 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF +++ b/profiling/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.linuxtools.profiling.launch;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.1.0.qualifier Bundle-Activator: org.eclipse.linuxtools.internal.profiling.launch.ProfileLaunchPlugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/plugin.xml b/profiling/org.eclipse.linuxtools.profiling.launch/plugin.xml index 29bc35467a..6ab136b779 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/plugin.xml +++ b/profiling/org.eclipse.linuxtools.profiling.launch/plugin.xml @@ -2,5 +2,6 @@ <?eclipse version="3.4"?> <plugin> <extension-point id="RemoteProxyManager" name="Remote Proxy Manager" schema="schema/RemoteProxyManager.exsd"/> + <extension-point id="launchProvider" name="Launch Provider" schema="schema/org.eclipse.linuxtools.profiling.launch.provider.exsd"/> </plugin> diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/pom.xml b/profiling/org.eclipse.linuxtools.profiling.launch/pom.xml index 0861970dd0..da34ec0d30 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/pom.xml +++ b/profiling/org.eclipse.linuxtools.profiling.launch/pom.xml @@ -18,7 +18,7 @@ </parent> <artifactId>org.eclipse.linuxtools.profiling.launch</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <name>Linux Tools Profiling Launch Plug-in</name> diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/schema/org.eclipse.linuxtools.profiling.launch.provider.exsd b/profiling/org.eclipse.linuxtools.profiling.launch/schema/org.eclipse.linuxtools.profiling.launch.provider.exsd new file mode 100644 index 0000000000..91360435b2 --- /dev/null +++ b/profiling/org.eclipse.linuxtools.profiling.launch/schema/org.eclipse.linuxtools.profiling.launch.provider.exsd @@ -0,0 +1,130 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.linuxtools.profiling.launch" xmlns="http://www.w3.org/2001/XMLSchema"> +<annotation> + <appinfo> + <meta.schema plugin="org.eclipse.linuxtools.profiling.launch" id="launchProvider" name="Launch Provider"/> + </appinfo> + <documentation> + This extension point allows various launch shortcuts that use the <code>ProfileLaunchShortcut</code> the ability to contribute its launcher(s) to a general set of profiling types. + </documentation> + </annotation> + + <element name="extension"> + <annotation> + <appinfo> + <meta.element /> + </appinfo> + </annotation> + <complexType> + <sequence minOccurs="1" maxOccurs="unbounded"> + <element ref="provider"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + + </documentation> + <appinfo> + <meta.attribute translatable="true"/> + </appinfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="provider"> + <complexType> + <attribute name="id" type="string" use="required"> + <annotation> + <documentation> + The unique identifier for this provider. + </documentation> + </annotation> + </attribute> + <attribute name="type" type="string" use="required"> + <annotation> + <documentation> + The type of profiling provided. + </documentation> + </annotation> + </attribute> + <attribute name="shortcut" type="string" use="required"> + <annotation> + <documentation> + A Class that extends <code>ProfileLaunchShortcut</code> and that will provide a launch for profiling. + </documentation> + <appinfo> + <meta.attribute kind="java" basedOn="org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut:"/> + </appinfo> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appinfo> + <meta.section type="since"/> + </appinfo> + <documentation> + 1.1.0 + </documentation> + </annotation> + + <annotation> + <appinfo> + <meta.section type="examples"/> + </appinfo> + <documentation> + <extension + point="org.eclipse.linuxtools.profiling.launch.launchProvider"> + <provider + id="org.eclipse.linuxtools.perf.provider" + shortcut="org.eclipse.linuxtools.internal.perf.launch.PerfLaunchShortcut" + type="snapshot"> + </provider> +</extension> + </documentation> + </annotation> + + <annotation> + <appinfo> + <meta.section type="apiinfo"/> + </appinfo> + <documentation> + Plug-ins that want to extend this extension point must make use of : <samp>org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut</samp> + </documentation> + </annotation> + + + <annotation> + <appinfo> + <meta.section type="copyright"/> + </appinfo> + <documentation> + Copyright (c) 2012 Red Hat, Inc. +All rights reserved. This program and the accompanying materials +are made available under the terms of the Eclipse Public License v1.0 +which accompanies this distribution, and is available at +http://www.eclipse.org/legal/epl-v10.html + +Contributors: + Roland Grunberg <rgrunber@redhat.com> - initial API and implementation + </documentation> + </annotation> + +</schema> diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java index f50f948313..6b8153f50a 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java +++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java @@ -27,8 +27,11 @@ import org.eclipse.cdt.ui.CElementLabelProvider; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; @@ -72,6 +75,39 @@ public abstract class ProfileLaunchShortcut implements ILaunchShortcut { } /** + * Get a profiling launch shortcut that provides the specified type of profiling. + * + * @param type A profiling type (eg. memory, snapshot, timing, etc.) + * @return a profiling launch shortcut that implements <code>ProfileLaunchShortcut</code> + * and provides the necessary profiling type, or <code>null</code> if none could be found. + * @since 1.1 + */ + public ProfileLaunchShortcut getProfilingProvider(String type) { + IExtensionPoint extPoint = Platform.getExtensionRegistry() + .getExtensionPoint(ProfileLaunchPlugin.PLUGIN_ID, "launchProvider"); //$NON-NLS-1$ + IConfigurationElement[] configs = extPoint.getConfigurationElements(); + for (IConfigurationElement config : configs) { + if (config.getName().equals("provider")) { //$NON-NLS-1$ + String currentType = config.getAttribute("type"); //$NON-NLS-1$ + String shortcut = config.getAttribute("shortcut"); //$NON-NLS-1$ + if (currentType != null && shortcut != null + && currentType.equals(type)) { + try { + Object obj = config.createExecutableExtension("shortcut"); //$NON-NLS-1$ + if (obj instanceof ProfileLaunchShortcut) { + return (ProfileLaunchShortcut) obj; + } + } catch (CoreException e) { + // continue, perhaps another configuration will succeed + } + } + } + } + + return null; + } + + /** * Locate a configuration to relaunch for the given type. If one cannot be found, create one. * * @return a re-useable config or <code>null</code> if none diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/.classpath b/profiling/org.eclipse.linuxtools.profiling.snapshot/.classpath new file mode 100644 index 0000000000..64c5e31b7a --- /dev/null +++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/.project b/profiling/org.eclipse.linuxtools.profiling.snapshot/.project new file mode 100644 index 0000000000..d8547804f9 --- /dev/null +++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.linuxtools.profiling.snapshot</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/.settings/org.eclipse.jdt.core.prefs b/profiling/org.eclipse.linuxtools.profiling.snapshot/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..2ce0206edd --- /dev/null +++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Jun 19 13:00:08 EDT 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/META-INF/MANIFEST.MF b/profiling/org.eclipse.linuxtools.profiling.snapshot/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..23e8ca25e0 --- /dev/null +++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Snapshot Profiling Plugin +Bundle-SymbolicName: org.eclipse.linuxtools.profiling.snapshot; singleton:=true +Bundle-Version: 1.1.0.qualifier +Bundle-Activator: org.eclipse.linuxtools.profiling.snapshot.Activator +Bundle-Vendor: Eclipse +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.debug.ui +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy +Import-Package: org.eclipse.cdt.core.model, + org.eclipse.linuxtools.profiling.launch diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/build.properties b/profiling/org.eclipse.linuxtools.profiling.snapshot/build.properties new file mode 100644 index 0000000000..2b0d95b6b0 --- /dev/null +++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + . diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/plugin.xml b/profiling/org.eclipse.linuxtools.profiling.snapshot/plugin.xml new file mode 100644 index 0000000000..87dfb5a997 --- /dev/null +++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/plugin.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension + id="org.eclipse.linuxtools.profiling.snapshot.launch" + name="Profile As Snapshot" + point="org.eclipse.debug.ui.launchShortcuts"> + <shortcut + class="org.eclipse.linuxtools.profiling.snapshot.launch.SnapshotLaunchShortcut" + id="org.eclipse.linuxtools.profiling.snapshot" + label="Profile As Snapshot" + modes="profile"> + + <contextualLaunch> + <enablement> + <with + variable="selection"> + <count + value="1"> + </count> + <iterate> + <or> + <instanceof + value="org.eclipse.cdt.core.model.IBinary"> + </instanceof> + <instanceof + value="org.eclipse.cdt.core.model.ICProject"> + </instanceof> + <test + property="org.eclipse.cdt.launch.isExecutable"> + </test> + <test + property="org.eclipse.cdt.launch.isCProject"> + </test> + <and> + <instanceof + value="org.eclipse.ui.IFileEditorInput"> + </instanceof> + <adapt + type="org.eclipse.core.resources.IResource"> + <adapt + type="org.eclipse.cdt.core.model.ICElement"> + </adapt> + </adapt> + </and> + </or> + </iterate> + </with> + </enablement> + </contextualLaunch> + </shortcut> + </extension> + + +</plugin> diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/Activator.java b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/Activator.java new file mode 100644 index 0000000000..25f67992fd --- /dev/null +++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/Activator.java @@ -0,0 +1,61 @@ +package org.eclipse.linuxtools.profiling.snapshot; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.linuxtools.profiling.snapshot"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchShortcut.java b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchShortcut.java new file mode 100644 index 0000000000..108efa5f5f --- /dev/null +++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchShortcut.java @@ -0,0 +1,27 @@ +package org.eclipse.linuxtools.profiling.snapshot.launch; + +import org.eclipse.cdt.core.model.IBinary; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut; + +public class SnapshotLaunchShortcut extends ProfileLaunchShortcut { + + @Override + public void launch(IBinary bin, String mode) { + ProfileLaunchShortcut provider = getProfilingProvider("snapshot"); + provider.launch(bin, mode); + } + + @Override + protected ILaunchConfigurationType getLaunchConfigType() { + return null; + } + + @Override + protected void setDefaultProfileAttributes( + ILaunchConfigurationWorkingCopy wc) throws CoreException { + } + +} |