Let's make use of the API break to re-simplify those interfaces.
Also dropped one of the range query methods, it is covered by
the new one.
Change-Id: If473d55983604b0cb52182009d1e79d4b9809eb7
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/7102
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com>
List<ITmfStateInterval> intervals;
quark = ssq.getQuarkAbsolute(Attributes.CPUS, "0", Attributes.CURRENT_THREAD);
- intervals = ssq.queryHistoryRange(quark, time1, time2, resolution);
+ intervals = ssq.queryHistoryRange(quark, time1, time2, resolution, null);
assertEquals(126, intervals.size()); /* Number of context switches! */
assertEquals(1452, intervals.get(50).getStateValue().unboxInt());
assertEquals(1331668248815698779L, intervals.get(100).getEndTime());
import org.eclipse.linuxtools.tmf.core.signal.TmfStateSystemBuildCompleted;\r
import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;\r
import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier;\r
-import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier2;\r
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;\r
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;\r
import org.eclipse.linuxtools.tmf.ui.views.TmfView;\r
if (endTime <= startTime) {\r
return null;\r
}\r
- IStateSystemQuerier2 ssq = (IStateSystemQuerier2) entry.getTrace().getStateSystem();\r
+ IStateSystemQuerier ssq = entry.getTrace().getStateSystem();\r
List<ITimeEvent> eventList = null;\r
try {\r
int statusQuark = ssq.getQuarkRelative(entry.getThreadQuark(), Attributes.STATUS);\r
import org.eclipse.linuxtools.tmf.core.signal.TmfStateSystemBuildCompleted;\r
import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;\r
import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier;\r
-import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier2;\r
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;\r
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;\r
import org.eclipse.linuxtools.tmf.ui.views.TmfView;\r
private static List<ITimeEvent> getEventList(ResourcesEntry entry,\r
long startTime, long endTime, long resolution, boolean includeNull,\r
IProgressMonitor monitor) {\r
- IStateSystemQuerier2 ssq = (IStateSystemQuerier2) entry.getTrace().getStateSystem();\r
+ IStateSystemQuerier ssq = entry.getTrace().getStateSystem();\r
startTime = Math.max(startTime, ssq.getStartTime());\r
endTime = Math.min(endTime, ssq.getCurrentEndTime() + 1);\r
if (endTime <= startTime) {\r
import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
import org.eclipse.linuxtools.tmf.core.interval.TmfStateInterval;
import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemBuilder;
-import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier2;
import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue;
* @author alexmont
*
*/
-public class StateSystem implements IStateSystemBuilder, IStateSystemQuerier2{
+public class StateSystem implements IStateSystemBuilder {
/* References to the inner structures */
private final AttributeTree attributeTree;
@Override
public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
- long t1, long t2, long resolution) throws TimeRangeException,
- AttributeNotFoundException {
- return queryHistoryRange(attributeQuark, t1, t2, resolution, new NullProgressMonitor());
- }
-
- @Override
- public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
- long t1, long t2, long resolution, IProgressMonitor monitor) throws TimeRangeException,
- AttributeNotFoundException {
+ long t1, long t2, long resolution, IProgressMonitor monitor)
+ throws TimeRangeException, AttributeNotFoundException {
List<ITmfStateInterval> intervals;
ITmfStateInterval currentInterval;
long ts, tEnd;
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+
/* Make sure the time range makes sense */
if (t2 < t1 || resolution <= 0) {
throw new TimeRangeException();
import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
* This is the read-only interface to the generic state system. It contains all
* the read-only quark-getting methods, as well as the history-querying ones.
*
- * @version 1.0
+ * @version 2.0
* @author Alexandre Montplaisir
*/
public interface IStateSystemQuerier {
/**
* Return the state history of a given attribute, but with at most one
* update per "resolution". This can be useful for populating views (where
- * it's useless to have more than one query per pixel, for example).
+ * it's useless to have more than one query per pixel, for example). A
+ * progress monitor can be used to cancel the query before completion.
*
* @param attributeQuark
* Which attribute this query is interested in
* history.
* @param resolution
* The "step" of this query
+ * @param monitor
+ * A progress monitor. If the monitor is canceled during a query,
+ * we will return what has been found up to that point. You can
+ * use "null" if you do not want to use one.
* @return The List of states that happened between t1 and t2
* @throws TimeRangeException
* If t1 is invalid, if t2 <= t1, or if the resolution isn't
* greater than zero.
* @throws AttributeNotFoundException
* If the attribute doesn't exist
+ * @since 2.0
*/
public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
- long t1, long t2, long resolution) throws TimeRangeException,
- AttributeNotFoundException;
+ long t1, long t2, long resolution, IProgressMonitor monitor)
+ throws TimeRangeException, AttributeNotFoundException;
}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012 Ericsson
- *
- * 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:
- * Patrick Tasse - IStateSystemQuerier API augmented for bug 382910
- ******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.statesystem;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
-import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
-import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
-
-/**
- * This interface augments the base interface IStateSystemQuerier.
- *
- * @version 1.1
- * @author Patrick Tasse
- * @since 1.1
- */
-public interface IStateSystemQuerier2 extends IStateSystemQuerier {
-
- /**
- * Return the state history of a given attribute, but with at most one
- * update per "resolution". This can be useful for populating views (where
- * it's useless to have more than one query per pixel, for example).
- * A progress monitor can be used to cancel the query before completion.
- *
- * @param attributeQuark
- * Which attribute this query is interested in
- * @param t1
- * Start time of the range query
- * @param t2
- * Target end time of the query. If t2 is greater than the end of
- * the trace, we will return what we have up to the end of the
- * history.
- * @param resolution
- * The "step" of this query
- * @param monitor
- * A progress monitor. If the monitor is canceled during a query,
- * we will return what has been found up to that point.
- * @return The List of states that happened between t1 and t2
- * @throws TimeRangeException
- * If t1 is invalid, if t2 <= t1, or if the resolution isn't
- * greater than zero.
- * @throws AttributeNotFoundException
- * If the attribute doesn't exist
- * @since 1.1
- */
- public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
- long t1, long t2, long resolution, IProgressMonitor monitor) throws TimeRangeException,
- AttributeNotFoundException;
-}