aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrajesh2014-01-10 11:13:39 (EST)
committerRodrigo Fraxino Araujo2014-01-13 10:52:11 (EST)
commiteb6c2344cdc0823eccec226f7067a2debae29e29 (patch)
tree22bd9a2e747795e18216984a1bce475ebe9dbb6c
parent498fde98d72b28962f9c79802ce4b4e2745a980c (diff)
downloadorg.eclipse.linuxtools-eb6c2344cdc0823eccec226f7067a2debae29e29.zip
org.eclipse.linuxtools-eb6c2344cdc0823eccec226f7067a2debae29e29.tar.gz
org.eclipse.linuxtools-eb6c2344cdc0823eccec226f7067a2debae29e29.tar.bz2
oprofile: fix for viewing, deleting and saving default sessionrefs/changes/78/20578/2
Fix if the profiling is done either with operf or opcontrol Change-Id: I1fdf20929a5a0cdd5b7cfecdca7e495a25e1d322 Signed-off-by: Brajesh <brrathor@linux.vnet.ibm.com> Signed-off-by: Rodrigo Fraxino Araujo <rfaraujo@br.ibm.com> Reviewed-on: https://git.eclipse.org/r/20578 Tested-by: Hudson CI Reviewed-by: Rodrigo Fraxino Araujo <rfaraujo@linux.vnet.ibm.com> IP-Clean: Rodrigo Fraxino Araujo <rfaraujo@linux.vnet.ibm.com> Tested-by: Rodrigo Fraxino Araujo <rfaraujo@linux.vnet.ibm.com>
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java1
-rwxr-xr-xoprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java28
-rwxr-xr-xoprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java17
3 files changed, 44 insertions, 2 deletions
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java
index b153f57..2be7e5e 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java
@@ -279,6 +279,7 @@ public class Oprofile
public final static String OPERF_BINARY = "operf"; //$NON-NLS-1$
public final static String OPCONTROL_BINARY = "opcontrol"; //$NON-NLS-1$
private static String binary = OPCONTROL_BINARY;
+ public final static String OPERF_DATA = "oprofile_data";
/**
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java
index 104e548..7d876c4 100755
--- a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java
@@ -10,10 +10,15 @@
*******************************************************************************/
package org.eclipse.linuxtools.internal.oprofile.ui.view;
+import java.io.File;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.linuxtools.internal.oprofile.core.OpcontrolException;
+import org.eclipse.linuxtools.internal.oprofile.core.Oprofile;
import org.eclipse.linuxtools.internal.oprofile.core.OprofileCorePlugin;
import org.eclipse.linuxtools.internal.oprofile.ui.OprofileUiPlugin;
import org.eclipse.linuxtools.oprofile.ui.model.UiModelSession;
@@ -50,9 +55,30 @@ public class OprofileViewDeleteSessionAction extends Action {
try {
OprofileCorePlugin.getDefault().getOpcontrolProvider().deleteSession(sessionName, eventName);
// clear out collected data by this session
- OprofileCorePlugin.getDefault().getOpcontrolProvider().reset();
+ // check if profile is done through operf or oprofile
+ if (Oprofile.OprofileProject.getProfilingBinary().equals(
+ Oprofile.OprofileProject.OPERF_BINARY)) {
+ // delete operf_data folder
+ deleteOperfDataFolder(Oprofile.OprofileProject.getProject()
+ .getFolder(Oprofile.OprofileProject.OPERF_DATA));
+ } else {
+ OprofileCorePlugin.getDefault().getOpcontrolProvider().reset();
+ }
} catch (OpcontrolException e) {
OprofileCorePlugin.showErrorDialog("opcontrolProvider", e); //$NON-NLS-1$
}
}
+
+ public static void deleteOperfDataFolder(IFolder operfData)
+ {
+ if(operfData.exists())
+ {
+ try {
+ operfData.delete(true,null);
+ } catch (CoreException e) {
+ OprofileCorePlugin.showErrorDialog("opcontrolProvider", e);
+ }
+ }
+
+ }
}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java
index 913283c..e50ab7a 100755
--- a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java
@@ -85,7 +85,22 @@ public class OprofileViewSaveDefaultSessionAction extends Action {
// remove the default session
OprofileCorePlugin.getDefault().getOpcontrolProvider().deleteSession(defaultSessionName, eventName);
// clear out collected data by this session
- OprofileCorePlugin.getDefault().getOpcontrolProvider().reset();
+ // if opcontol is used
+ if (!Oprofile.OprofileProject.OPERF_BINARY
+ .equals(Oprofile.OprofileProject
+ .getProfilingBinary())) {
+ OprofileCorePlugin.getDefault().getOpcontrolProvider()
+ .reset();
+ }
+ else
+ {
+ // remove oprofile_data so current event no longer be there
+ OprofileViewDeleteSessionAction
+ .deleteOperfDataFolder(Oprofile.OprofileProject
+ .getProject()
+ .getFolder(
+ Oprofile.OprofileProject.OPERF_DATA));
+ }
OprofileUiPlugin.getDefault().getOprofileView().refreshView();
} catch (OpcontrolException oe) {
OprofileCorePlugin.showErrorDialog("opcontrolProvider", oe); //$NON-NLS-1$