This allows getting the trace set (ie, encapsulating the TmfExperiment
instance check, etc.) for any trace, and not only the active one.
Change-Id: I876e8fb9956b10be6259341f49b54f3e9706be1f
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/12648
Tested-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
IP-Clean: Patrick Tasse <patrick.tasse@gmail.com>
- * Get the currently active trace set. For a 'normal' trace, this is simply
- * an array with only that trace in it. For trace experiments, this will be
- * an array containing the 'real' child traces in the experiment.
+ * Get the trace set of the currently active trace.
*
* @return The active trace set
*
* @return The active trace set
+ * @see #getTraceSet(ITmfTrace)
*/
public synchronized ITmfTrace[] getActiveTraceSet() {
final ITmfTrace trace = fCurrentTrace;
*/
public synchronized ITmfTrace[] getActiveTraceSet() {
final ITmfTrace trace = fCurrentTrace;
- if (trace instanceof TmfExperiment) {
- final TmfExperiment exp = (TmfExperiment) trace;
- return exp.getTraces();
- }
- return new ITmfTrace[] { trace };
+ return getTraceSet(trace);
}
private TmfTraceContext getCurrentTraceContext() {
}
private TmfTraceContext getCurrentTraceContext() {
+ /**
+ * Get the trace set of a given trace. For a standard trace, this is simply
+ * an array with only that trace in it. For experiments, this is an array of
+ * all the traces contained in this experiment.
+ *
+ * @param trace
+ * The trace or experiment
+ * @return The corresponding trace set
+ */
+ public static ITmfTrace[] getTraceSet(ITmfTrace trace) {
+ if (trace == null) {
+ return null;
+ }
+ if (trace instanceof TmfExperiment) {
+ TmfExperiment exp = (TmfExperiment) trace;
+ return exp.getTraces();
+ }
+ return new ITmfTrace[] { trace };
+ }
+
// ------------------------------------------------------------------------
// Signal handlers
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Signal handlers
// ------------------------------------------------------------------------