tmf: Register statistics state systems into the trace
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Wed, 3 Apr 2013 19:38:00 +0000 (15:38 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Wed, 10 Apr 2013 22:18:22 +0000 (18:18 -0400)
This way they will show up in the State System Explorer, among
other things.

Change-Id: I40c49600b8bac40e5c49f2877cd42d578c1229ea
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/11660

org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statistics/TmfStateStatistics.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTrace.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java

index ea248b1b5a8b155af587f3dcd116c469a25d9b8f..8afe20765ea32e893f06b9e9550babdc531ba347 100644 (file)
@@ -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);
     }
 
     // ------------------------------------------------------------------------
index 23442b1f37a2ac062393fa22e7f9db25ab2908f0..784932887032c405e5fb38eee58b9eb36efc7eb3 100644 (file)
@@ -201,6 +201,21 @@ public interface ITmfTrace extends ITmfDataProvider {
      */
     public Collection<String> 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
     // ------------------------------------------------------------------------
index 2a51547e2b016d96df32b5de8778cca018b5972e..dac5301261b6419621da3db37c000689f2b65ef0 100644 (file)
@@ -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
     // ------------------------------------------------------------------------
This page took 0.028157 seconds and 5 git commands to generate.