aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamilo Bernal2012-12-21 15:44:26 (EST)
committerRoland Grunberg2013-01-02 10:55:37 (EST)
commitf2ef3bddf6e71e5681177de8b07fd052b91d6ed1 (patch)
treea589ef2dbad9a2983df761ba477e09be6eb4c7e3
parentf5994866dffd97c7fa58eee64d381f3ec073ba5a (diff)
downloadorg.eclipse.linuxtools-f2ef3bddf6e71e5681177de8b07fd052b91d6ed1.zip
org.eclipse.linuxtools-f2ef3bddf6e71e5681177de8b07fd052b91d6ed1.tar.gz
org.eclipse.linuxtools-f2ef3bddf6e71e5681177de8b07fd052b91d6ed1.tar.bz2
Further refactoring of PerfCore.refs/changes/97/9397/2
Isolated parsing of events list and logic for accessing and clearing the plug-in's model root. Change-Id: I2a01a18fee3ebe93be489a012e2a26d122c3c208 Reviewed-on: https://git.eclipse.org/r/9397 Tested-by: Hudson CI Reviewed-by: Roland Grunberg <rgrunber@redhat.com> IP-Clean: Roland Grunberg <rgrunber@redhat.com> Tested-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java29
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfPlugin.java13
2 files changed, 20 insertions, 22 deletions
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 4beafc3..a6acee0 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
@@ -163,7 +163,11 @@ public class PerfCore {
} catch( IOException e ) {
e.printStackTrace();
}
+ return parseEventList(input);
+ }
+ public static HashMap<String,ArrayList<String>> parseEventList (BufferedReader input){
+ HashMap<String,ArrayList<String>> events = new HashMap<String,ArrayList<String>>();
String line;
try {
// Process list of events. Each line is of the form <event>\s+<category>.
@@ -205,16 +209,9 @@ public class PerfCore {
return events;
}
-
//Gets the current version of perf
public static String getPerfVersion(ILaunchConfiguration config, String[] environ, IPath workingDir) {
- ConfigUtils configUtils = new ConfigUtils(config);
- IProject project = null;
- try {
- project = ConfigUtils.getProject(configUtils.getProjectName());
- } catch (CoreException e1) {
- e1.printStackTrace();
- }
+ IProject project = getProject(config);
Process p = null;
IRemoteFileProxy proxy = null;
IFileStore workingDirFileStore = null;
@@ -362,20 +359,8 @@ public class PerfCore {
//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) {
- ConfigUtils configUtils = new ConfigUtils(config);
- IProject project = null;
- try {
- project = ConfigUtils.getProject(configUtils.getProjectName());
- } catch (CoreException e1) {
- e1.printStackTrace();
- }
- TreeParent invisibleRoot = PerfPlugin.getDefault().getModelRoot();
- if (invisibleRoot == null) {
- invisibleRoot = new TreeParent("");
- PerfPlugin.getDefault().setModelRoot(invisibleRoot);
- } else {
- invisibleRoot.clear();
- }
+ IProject project = getProject(config);
+ TreeParent invisibleRoot = PerfPlugin.getDefault().clearModelRoot();
boolean OldPerfVersion = false;
if (getPerfVersion(config, environ, workingDir).contains("perf version 0.0.2.PERF")) {
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfPlugin.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfPlugin.java
index f112be7..e7bb614 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfPlugin.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfPlugin.java
@@ -99,6 +99,19 @@ public class PerfPlugin extends AbstractUIPlugin {
return _modelRoot;
}
+ /**
+ * Return cleared model root.
+ * @return TreeParent cleared model root.
+ */
+ public TreeParent clearModelRoot(){
+ if (_modelRoot == null) {
+ _modelRoot = new TreeParent("");
+ } else {
+ _modelRoot.clear();
+ }
+ return _modelRoot;
+ }
+
public void setModelRoot(TreeParent rootnode) {
this._modelRoot = rootnode;
}