From: Alexandre Montplaisir Date: Wed, 3 Apr 2013 19:38:00 +0000 (-0400) Subject: tmf: Register statistics state systems into the trace X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=6c5e08638ddbb6616d5bb8c9215c2539fc2530b4;p=deliverable%2Ftracecompass.git tmf: Register statistics state systems into the trace This way they will show up in the State System Explorer, among other things. Change-Id: I40c49600b8bac40e5c49f2877cd42d578c1229ea Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/11660 --- diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statistics/TmfStateStatistics.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statistics/TmfStateStatistics.java index ea248b1b5a..8afe20765e 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statistics/TmfStateStatistics.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statistics/TmfStateStatistics.java @@ -97,6 +97,7 @@ public class TmfStateStatistics implements ITmfStatistics { final IStateChangeInput htInput = new StatsStateProvider(trace); this.stats = StateSystemManager.loadStateHistory(htFile, htInput, false); + registerStateSystems(); } /** @@ -115,6 +116,14 @@ public class TmfStateStatistics implements ITmfStatistics { this.trace = trace; final IStateChangeInput htInput = new StatsStateProvider(trace); this.stats = StateSystemManager.loadStateHistory(historyFile, htInput, true); + registerStateSystems(); + } + + /** + * Register the state systems used here into the trace's state system array. + */ + private void registerStateSystems() { + trace.registerStateSystem(STATE_ID, stats); } // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTrace.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTrace.java index 23442b1f37..7849328870 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTrace.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTrace.java @@ -201,6 +201,21 @@ public interface ITmfTrace extends ITmfDataProvider { */ public Collection listStateSystems(); + /** + * If a state system is not build by the trace itself, it's possible to + * register it if it comes from another source. It will then be accessible + * with {@link #getStateSystems} normally. + * + * @param id + * The unique ID to assign to this state system. In case of + * conflicting ID's, the new one will overwrite the previous one + * (default Map behavior). + * @param ss + * The already-built state system + * @since 2.0 + */ + public void registerStateSystem(String id, ITmfStateSystem ss); + // ------------------------------------------------------------------------ // Trace characteristics getters // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java index 2a51547e2b..dac5301261 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java @@ -417,6 +417,14 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace { return fStateSystems.keySet(); } + /** + * @since 2.0 + */ + @Override + public final void registerStateSystem(String id, ITmfStateSystem ss) { + fStateSystems.put(id, ss); + } + // ------------------------------------------------------------------------ // ITmfTrace - Trace characteristics getters // ------------------------------------------------------------------------