aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamilo Bernal2013-05-09 17:43:14 (EDT)
committerAlexander Kurtakov2013-05-13 06:40:13 (EDT)
commita94daf69e56141a74aa9e1a5ff391aaa812111e3 (patch)
tree6a883248fef8bcb8ef5b146c62b304158b047d1c
parentbb769a304285786deed24564fc0d09e64657374e (diff)
downloadorg.eclipse.linuxtools-a94daf69e56141a74aa9e1a5ff391aaa812111e3.zip
org.eclipse.linuxtools-a94daf69e56141a74aa9e1a5ff391aaa812111e3.tar.gz
org.eclipse.linuxtools-a94daf69e56141a74aa9e1a5ff391aaa812111e3.tar.bz2
Perf: Introduce IPerfData interface to represent general perf data.refs/changes/27/12727/3
Change-Id: I3973afa9f2b9730fef4eb028e0ea5445854a88b4 Reviewed-on: https://git.eclipse.org/r/12727 Tested-by: Hudson CI Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> IP-Clean: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/StatsComparisonTest.java2
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/AbstractDataManipulator.java4
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/IPerfData.java29
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfPlugin.java18
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/StatComparisonData.java6
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/PerfSaveStatsHandler.java6
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/SourceDisassemblyView.java4
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/StatComparisonView.java5
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/StatView.java6
9 files changed, 57 insertions, 23 deletions
diff --git a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/StatsComparisonTest.java b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/StatsComparisonTest.java
index 7666bf0..2834b22 100644
--- a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/StatsComparisonTest.java
+++ b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/StatsComparisonTest.java
@@ -175,7 +175,7 @@ public class StatsComparisonTest {
oldStatData, newStatData);
diffData.runComparison();
- String actualResult = diffData.getResult();
+ String actualResult = diffData.getPerfData();
String[] actualResultLines = actualResult.split("\n");
String curLine;
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/AbstractDataManipulator.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/AbstractDataManipulator.java
index 9b1e6e3..4654849 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/AbstractDataManipulator.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/AbstractDataManipulator.java
@@ -32,7 +32,7 @@ import org.eclipse.ui.console.IOConsole;
* This class represents the general flow of a perf command being
* set up, executed, and having its data collected.
*/
-public abstract class AbstractDataManipulator {
+public abstract class AbstractDataManipulator implements IPerfData {
private String text;
private String title;
@@ -44,6 +44,7 @@ public abstract class AbstractDataManipulator {
this.workDir = workDir;
}
+ @Override
public String getPerfData() {
return text;
}
@@ -51,6 +52,7 @@ public abstract class AbstractDataManipulator {
protected File getWorkDir(){
return workDir;
}
+ @Override
public String getTitle () {
return title;
}
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/IPerfData.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/IPerfData.java
new file mode 100644
index 0000000..305c879
--- /dev/null
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/IPerfData.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ * Red Hat Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.perf;
+
+/**
+ * Interface for generic perf data.
+ */
+public interface IPerfData {
+
+ /**
+ * Get string representation of the data.
+ * @return String perf data
+ */
+ public String getPerfData();
+
+ /**
+ * Get title for this data.
+ * @return title for perf data
+ */
+ public String getTitle();
+}
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 2cf42fd..94e942b 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
@@ -116,10 +116,10 @@ public class PerfPlugin extends AbstractUIPlugin {
private TreeParent _modelRoot;
// Source Disassembly Data
- private SourceDisassemblyData sourceDisassemblyData;
+ private IPerfData sourceDisassemblyData;
// Stat Data
- private StatData statData;
+ private IPerfData statData;
// Profile view
private PerfProfileView _ProfileView = null;
@@ -131,17 +131,17 @@ public class PerfPlugin extends AbstractUIPlugin {
private IPath curWorkingDir;
// Current stat comparison data
- private StatComparisonData statDiffData;
+ private IPerfData statDiffData;
public TreeParent getModelRoot() {
return _modelRoot;
}
- public SourceDisassemblyData getSourceDisassemblyData () {
+ public IPerfData getSourceDisassemblyData () {
return sourceDisassemblyData;
}
- public StatData getStatData () {
+ public IPerfData getStatData () {
return statData;
}
@@ -149,7 +149,7 @@ public class PerfPlugin extends AbstractUIPlugin {
return curProfileData;
}
- public StatComparisonData getStatDiffData() {
+ public IPerfData getStatDiffData() {
return statDiffData;
}
@@ -189,11 +189,11 @@ public class PerfPlugin extends AbstractUIPlugin {
this._modelRoot = rootnode;
}
- public void setSourceDisassemblyData (SourceDisassemblyData sourceDisassemblyData) {
+ public void setSourceDisassemblyData (IPerfData sourceDisassemblyData) {
this.sourceDisassemblyData = sourceDisassemblyData;
}
- public void setStatData (StatData statData) {
+ public void setStatData (IPerfData statData) {
this.statData = statData;
}
@@ -201,7 +201,7 @@ public class PerfPlugin extends AbstractUIPlugin {
this.curProfileData = perfProfileData;
}
- public void setStatDiffData(StatComparisonData diffData){
+ public void setStatDiffData(IPerfData diffData){
this.statDiffData = diffData;
}
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/StatComparisonData.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/StatComparisonData.java
index 91d0597..a480a2b 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/StatComparisonData.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/StatComparisonData.java
@@ -26,7 +26,7 @@ import org.eclipse.linuxtools.internal.perf.model.PMStatEntry.Type;
/**
* Class containing all functionality for comparting perf statistics data.
*/
-public class StatComparisonData {
+public class StatComparisonData implements IPerfData {
// Old stats file.
private File oldFile;
@@ -45,10 +45,12 @@ public class StatComparisonData {
this.newFile = newFile;
}
- public String getResult() {
+ @Override
+ public String getPerfData() {
return result;
}
+ @Override
public String getTitle() {
return title;
}
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/PerfSaveStatsHandler.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/PerfSaveStatsHandler.java
index dd104ee..42da8d9 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/PerfSaveStatsHandler.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/PerfSaveStatsHandler.java
@@ -15,8 +15,8 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.linuxtools.internal.perf.IPerfData;
import org.eclipse.linuxtools.internal.perf.PerfPlugin;
-import org.eclipse.linuxtools.internal.perf.StatData;
/**
* Handler for saving a perf statistics session.
@@ -28,7 +28,7 @@ public class PerfSaveStatsHandler extends AbstractSaveDataHandler {
@Override
public File saveData(String filename) {
IPath newDataLoc = getNewDataLocation(filename, DATA_EXT);
- StatData statData = PerfPlugin.getDefault().getStatData();
+ IPerfData statData = PerfPlugin.getDefault().getStatData();
File statsData = new File(newDataLoc.toOSString());
@@ -53,7 +53,7 @@ public class PerfSaveStatsHandler extends AbstractSaveDataHandler {
@Override
public boolean verifyData() {
- StatData statData = PerfPlugin.getDefault().getStatData();
+ IPerfData statData = PerfPlugin.getDefault().getStatData();
return statData != null && statData.getPerfData() != null;
}
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/SourceDisassemblyView.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/SourceDisassemblyView.java
index 2cd6277..a54a038 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/SourceDisassemblyView.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/SourceDisassemblyView.java
@@ -20,8 +20,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.text.IFindReplaceTarget;
+import org.eclipse.linuxtools.internal.perf.IPerfData;
import org.eclipse.linuxtools.internal.perf.PerfPlugin;
-import org.eclipse.linuxtools.internal.perf.SourceDisassemblyData;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
@@ -61,7 +61,7 @@ public class SourceDisassemblyView extends ViewPart implements IFindReplaceTarge
text = new StyledText(parent, SWT.WRAP | SWT.V_SCROLL);
text.setEditable(false);
- SourceDisassemblyData data = PerfPlugin.getDefault().getSourceDisassemblyData();
+ IPerfData data = PerfPlugin.getDefault().getSourceDisassemblyData();
if (data != null) {
setStyledText(data.getPerfData());
setContentDescription(data.getTitle());
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/StatComparisonView.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/StatComparisonView.java
index c55e3ae..1281224 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/StatComparisonView.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/StatComparisonView.java
@@ -18,6 +18,7 @@ import java.util.regex.Pattern;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.linuxtools.internal.perf.IPerfData;
import org.eclipse.linuxtools.internal.perf.PerfPlugin;
import org.eclipse.linuxtools.internal.perf.StatComparisonData;
import org.eclipse.linuxtools.internal.perf.model.PMStatEntry;
@@ -59,10 +60,10 @@ public class StatComparisonView extends ViewPart {
text = new StyledText(parent, SWT.WRAP | SWT.V_SCROLL);
text.setEditable(false);
- StatComparisonData statsDiff = PerfPlugin.getDefault()
+ IPerfData statsDiff = PerfPlugin.getDefault()
.getStatDiffData();
if (statsDiff != null) {
- setStyledText(statsDiff.getResult());
+ setStyledText(statsDiff.getPerfData());
setContentDescription(statsDiff.getTitle());
}
}
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/StatView.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/StatView.java
index 3fb368e..c07cf0d 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/StatView.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/StatView.java
@@ -13,8 +13,8 @@ package org.eclipse.linuxtools.internal.perf.ui;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.linuxtools.internal.perf.IPerfData;
import org.eclipse.linuxtools.internal.perf.PerfPlugin;
-import org.eclipse.linuxtools.internal.perf.StatData;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.layout.GridLayout;
@@ -41,7 +41,7 @@ public class StatView extends ViewPart {
text = new StyledText(parent, SWT.WRAP | SWT.V_SCROLL);
text.setEditable(false);
- StatData data = PerfPlugin.getDefault().getStatData();
+ IPerfData data = PerfPlugin.getDefault().getStatData();
if (data != null) {
setStyledText(data.getPerfData());
setContentDescription(data.getTitle());
@@ -63,7 +63,7 @@ public class StatView extends ViewPart {
* Update to most recent statistics data.
*/
public void updateData(){
- StatData data = PerfPlugin.getDefault().getStatData();
+ IPerfData data = PerfPlugin.getDefault().getStatData();
if (data != null) {
setStyledText(data.getPerfData());
setContentDescription(data.getTitle());