/*******************************************************************************
- * Copyright (c) 2009, 2014 Ericsson, École Polytechnique de Montréal
+ * Copyright (c) 2009, 2015 Ericsson, École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.tmf.core.Activator;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModuleHelper;
import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Multimap;
/**
* Abstract implementation of ITmfTrace.
// The resource used for persistent properties for this trace
private IResource fResource;
+ // The trace type id
+ private @Nullable String fTraceTypeId;
+
// The trace path
private String fPath;
private volatile long fNbEvents = 0;
// The time span of the event stream
- private ITmfTimestamp fStartTime = TmfTimestamp.BIG_BANG;
- private ITmfTimestamp fEndTime = TmfTimestamp.BIG_BANG;
+ private @NonNull ITmfTimestamp fStartTime = TmfTimestamp.BIG_BANG;
+ private @NonNull ITmfTimestamp fEndTime = TmfTimestamp.BIG_BANG;
// The trace streaming interval (0 = no streaming)
private long fStreamingInterval = 0;
*/
public TmfTrace() {
super();
- fIndexer = createIndexer(DEFAULT_BLOCK_SIZE);
+ fIndexer = new TmfCheckpointIndexer(this);
}
/**
* @param interval the checkpoints interval
*
* @return the indexer
- * @since 3.0
*/
protected ITmfTraceIndexer createIndexer(int interval) {
return new TmfCheckpointIndexer(this, interval);
// ------------------------------------------------------------------------
@Override
- public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> type, String name) throws TmfTraceException {
+ public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> type, String name, String traceTypeId) throws TmfTraceException {
if (name == null) {
throw new IllegalArgumentException();
}
setName(name);
+ fTraceTypeId = traceTypeId;
initTrace(resource, path, type);
}
return file.exists();
}
- /**
- * @since 2.0
- */
@Override
public void indexTrace(boolean waitForCompletion) {
getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, waitForCompletion);
*
* @return An IStatus indicating whether the analysis could be run
* successfully or not
- * @since 3.0
*/
protected IStatus executeAnalysis() {
MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null);
- Class<? extends TmfTrace> className = checkNotNull(this.getClass());
- Map<String, IAnalysisModuleHelper> modules = TmfAnalysisManager.getAnalysisModules(className);
+ Multimap<String, IAnalysisModuleHelper> modules = TmfAnalysisManager.getAnalysisModules();
for (IAnalysisModuleHelper helper : modules.values()) {
try {
IAnalysisModule module = helper.newModule(this);
+ if (module == null) {
+ continue;
+ }
fAnalysisModules.put(module.getId(), module);
if (module.isAutomatic()) {
status.add(module.schedule());
return status;
}
- /**
- * @since 3.0
- */
@Override
public IAnalysisModule getAnalysisModule(String analysisId) {
return fAnalysisModules.get(analysisId);
}
- /**
- * @since 3.0
- */
@Override
public Iterable<IAnalysisModule> getAnalysisModules() {
synchronized (fAnalysisModules) {
return fResource;
}
+ @Override
+ public @Nullable String getTraceTypeId() {
+ return fTraceTypeId;
+ }
+
@Override
public String getPath() {
return fPath;
/**
* @return the trace indexer
- * @since 3.0
*/
protected ITmfTraceIndexer getIndexer() {
return fIndexer;
return fNbEvents;
}
- /**
- * @since 2.0
- */
@Override
- public TmfTimeRange getTimeRange() {
+ public @NonNull TmfTimeRange getTimeRange() {
return new TmfTimeRange(fStartTime, fEndTime);
}
- /**
- * @since 2.0
- */
@Override
public ITmfTimestamp getStartTime() {
return fStartTime;
}
- /**
- * @since 2.0
- */
@Override
public ITmfTimestamp getEndTime() {
return fEndTime;
}
- /**
- * @since 2.0
- */
@Override
public ITmfTimestamp getInitialRangeOffset() {
final long DEFAULT_INITIAL_OFFSET_VALUE = (1L * 100 * 1000 * 1000); // .1sec
return new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, ITmfTimestamp.NANOSECOND_SCALE);
}
- /**
- * @since 3.0
- */
@Override
public String getHostId() {
return this.getName();
* Update the trace events time range
*
* @param range the new time range
- * @since 2.0
*/
- protected void setTimeRange(final TmfTimeRange range) {
+ protected void setTimeRange(final @NonNull TmfTimeRange range) {
fStartTime = range.getStartTime();
fEndTime = range.getEndTime();
}
* Update the trace chronologically first event timestamp
*
* @param startTime the new first event timestamp
- * @since 2.0
*/
- protected void setStartTime(final ITmfTimestamp startTime) {
+ protected void setStartTime(final @NonNull ITmfTimestamp startTime) {
fStartTime = startTime;
}
* Update the trace chronologically last event timestamp
*
* @param endTime the new last event timestamp
- * @since 2.0
*/
- protected void setEndTime(final ITmfTimestamp endTime) {
+ protected void setEndTime(final @NonNull ITmfTimestamp endTime) {
fEndTime = endTime;
}
return context;
}
- /**
- * @since 2.0
- */
@Override
public synchronized ITmfContext seekEvent(final ITmfTimestamp timestamp) {
// parseEvent() does not update the context
final ITmfEvent event = parseEvent(context);
if (event != null) {
- updateAttributes(context, event.getTimestamp());
+ ITmfTimestamp timestamp = event.getTimestamp();
+ updateAttributes(context, timestamp);
context.setLocation(getCurrentLocation());
context.increaseRank();
}
*
* @param context the current trace context
* @param timestamp the corresponding timestamp
- * @since 2.0
*/
- protected synchronized void updateAttributes(final ITmfContext context, final ITmfTimestamp timestamp) {
+ protected synchronized void updateAttributes(final ITmfContext context, final @NonNull ITmfTimestamp timestamp) {
if (fStartTime.equals(TmfTimestamp.BIG_BANG) || (fStartTime.compareTo(timestamp) > 0)) {
fStartTime = timestamp;
}
// TmfDataProvider
// ------------------------------------------------------------------------
- /**
- * @since 2.0
- */
@Override
public synchronized ITmfContext armRequest(final ITmfEventRequest request) {
if (executorIsShutdown()) {
*
* @param signal
* The incoming signal
- * @since 2.0
*/
@TmfSignalHandler
public void traceOpened(TmfTraceOpenedSignal signal) {
* Signal handler for the TmfTraceRangeUpdatedSignal signal
*
* @param signal The incoming signal
- * @since 2.0
*/
@TmfSignalHandler
public void traceRangeUpdated(final TmfTraceRangeUpdatedSignal signal) {
* Signal handler for the TmfTraceUpdatedSignal signal
*
* @param signal The incoming signal
- * @since 3.0
*/
@TmfSignalHandler
public void traceUpdated(final TmfTraceUpdatedSignal signal) {
// Timestamp transformation functions
// ------------------------------------------------------------------------
- /**
- * @since 3.0
- */
@Override
public ITmfTimestampTransform getTimestampTransform() {
if (fTsTransform == null) {
return fTsTransform;
}
- /**
- * @since 3.0
- */
@Override
public void setTimestampTransform(final ITmfTimestampTransform tt) {
fTsTransform = tt;
TimestampTransformFactory.setTimestampTransform(getResource(), tt);
}
- /**
- * @since 3.0
- */
@Override
- public ITmfTimestamp createTimestamp(long ts) {
+ public @NonNull ITmfTimestamp createTimestamp(long ts) {
return new TmfNanoTimestamp(getTimestampTransform().transform(ts));
}
+ ", fEndTime=" + fEndTime + ", fStreamingInterval=" + fStreamingInterval + "]";
}
- /**
- * @since 3.1
- */
@Override
public boolean isComplete() {
/*
return true;
}
- /**
- * @since 3.1
- */
@Override
public void setComplete(boolean isComplete) {
/*