summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorCamilo Bernal2013-03-15 17:32:01 (EDT)
committer Roland Grunberg2013-03-20 11:21:43 (EDT)
commit16d11c577f6d0cb82109b4068cf07aacf52fc2d8 (patch)
tree47d9b7e38e7a3e6dca5cdbd8361ede1c8604782f
parent402c2f9a249d27285c099f5fe31236c48bf60628 (diff)
downloadorg.eclipse.linuxtools-16d11c577f6d0cb82109b4068cf07aacf52fc2d8.zip
org.eclipse.linuxtools-16d11c577f6d0cb82109b4068cf07aacf52fc2d8.tar.gz
org.eclipse.linuxtools-16d11c577f6d0cb82109b4068cf07aacf52fc2d8.tar.bz2
Save most recent perf stat session under the working directory.refs/changes/13/11213/2
This will be useful for referring to the latest session for quick comparison between the current and last session. Change-Id: I6c334c9ef12868b16287fd53ac6e152985b3f2de Reviewed-on: https://git.eclipse.org/r/11213 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/handlers/PerfSaveStatsHandler.java2
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java18
2 files changed, 19 insertions, 1 deletions
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 599d2f1..dd104ee 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
@@ -23,7 +23,7 @@ import org.eclipse.linuxtools.internal.perf.StatData;
*/
public class PerfSaveStatsHandler extends AbstractSaveDataHandler {
- private static String DATA_EXT = "stat"; //$NON-NLS-1$
+ public static String DATA_EXT = "stat"; //$NON-NLS-1$
@Override
public File saveData(String filename) {
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 468fbc3..7113030 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
@@ -41,6 +41,7 @@ import org.eclipse.linuxtools.internal.perf.PerfCore;
import org.eclipse.linuxtools.internal.perf.PerfPlugin;
import org.eclipse.linuxtools.internal.perf.SourceDisassemblyData;
import org.eclipse.linuxtools.internal.perf.StatData;
+import org.eclipse.linuxtools.internal.perf.handlers.PerfSaveStatsHandler;
import org.eclipse.linuxtools.internal.perf.ui.SourceDisassemblyView;
import org.eclipse.linuxtools.internal.perf.ui.StatView;
import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationDelegate;
@@ -107,6 +108,23 @@ public class PerfLaunchConfigDelegate extends ProfileLaunchConfigurationDelegate
sd = new StatData(title, exePath.toOSString(), arguments, runCount, statEvents);
sd.parse();
PerfPlugin.getDefault().setStatData(sd);
+
+ StringBuilder perfStatFile = new StringBuilder();
+ perfStatFile.append(PerfPlugin.PERF_COMMAND);
+ perfStatFile.append("."); //$NON-NLS-1$
+ perfStatFile.append(PerfSaveStatsHandler.DATA_EXT);
+
+ // perf.stat will be replaced by the most recent session
+ File latestStatData = new File(workingDir.append(
+ perfStatFile.toString()).toOSString());
+ if(latestStatData.exists()){
+ latestStatData.delete();
+ }
+
+ // keep track of most recent session in file perf.stat
+ PerfSaveStatsHandler saveStats = new PerfSaveStatsHandler();
+ saveStats.saveData(PerfPlugin.PERF_COMMAND);
+
StatView.refreshView();
} else {
ArrayList<String> command = new ArrayList<String>();