X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.tmf.core%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Ftmf%2Fcore%2Fstatesystem%2FStateSystemManager.java;h=205bdfa1ceb0e4ad60424a75e8dc1d4376d73e5f;hb=f9a76cacf7d7cb5e0f6edfcc6d786635864caae5;hp=b73714ee3eb014f79f128b51a03362fb2dced5e2;hpb=e5d31efe8543838f2ecb9e33cb7c42096c18188a;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/StateSystemManager.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/StateSystemManager.java index b73714ee3e..205bdfa1ce 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/StateSystemManager.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/StateSystemManager.java @@ -16,9 +16,11 @@ import java.io.File; import java.io.IOException; import org.eclipse.linuxtools.internal.tmf.core.statesystem.HistoryBuilder; -import org.eclipse.linuxtools.internal.tmf.core.statesystem.IStateHistoryBackend; -import org.eclipse.linuxtools.internal.tmf.core.statesystem.historytree.HistoryTreeBackend; -import org.eclipse.linuxtools.internal.tmf.core.statesystem.historytree.ThreadedHistoryTreeBackend; +import org.eclipse.linuxtools.internal.tmf.core.statesystem.backends.IStateHistoryBackend; +import org.eclipse.linuxtools.internal.tmf.core.statesystem.backends.InMemoryBackend; +import org.eclipse.linuxtools.internal.tmf.core.statesystem.backends.NullBackend; +import org.eclipse.linuxtools.internal.tmf.core.statesystem.backends.historytree.HistoryTreeBackend; +import org.eclipse.linuxtools.internal.tmf.core.statesystem.backends.historytree.ThreadedHistoryTreeBackend; import org.eclipse.linuxtools.tmf.core.component.TmfComponent; import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException; @@ -102,4 +104,47 @@ public abstract class StateSystemManager extends TmfComponent { } return builder.getStateSystemQuerier(); } + + /** + * Create a new state system using a null history back-end. This means that + * no history intervals will be saved anywhere, and as such only + * {@link ITmfStateSystem#queryOngoingState} will be available. + * + * This has to be built "manually" (which means you should call + * input.processEvent() to update the ongoing state of the state system). + * + * @param input + * The input plugin to build the history + * @return Reference to the history-less state system that got built + * @since 2.0 + */ + public static ITmfStateSystem newNullHistory(IStateChangeInput input) { + IStateHistoryBackend backend = new NullBackend(); + HistoryBuilder builder = new HistoryBuilder(input, backend, true); + ITmfStateSystem ss = builder.getStateSystemQuerier(); + return ss; + } + + /** + * Create a new state system using in-memory interval storage. This should + * only be done for very small state system, and will be naturally limited + * to 2^31 intervals. + * + * This will block the caller while the construction is ongoing. + * + * @param input + * The state change input to use + * @param buildManually + * Set to true to block the caller and build without using TMF + * signals (for test programs most of the time). Use false if you + * are using the TMF facilities (experiments, etc.) + * @return Reference to the state system that just got built + * @since 2.0 + */ + public static ITmfStateSystem newInMemHistory(IStateChangeInput input, + boolean buildManually) { + IStateHistoryBackend backend = new InMemoryBackend(input.getStartTime()); + HistoryBuilder builder = new HistoryBuilder(input, backend, buildManually); + return builder.getStateSystemQuerier(); + } }