import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.btf.core.event.BtfEvent;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect;
private static final Iterable<ITmfEventAspect<?>> BTF_ASPECTS =
ImmutableList.of(
- ITmfEventAspect.BaseAspects.TIMESTAMP,
+ TmfBaseAspects.getTimestampAspect(),
new BtfSourceAspect(),
new TmfContentFieldAspect(BtfColumnNames.SOURCE_INSTANCE.toString(), BtfColumnNames.SOURCE_INSTANCE.toString()),
- ITmfEventAspect.BaseAspects.EVENT_TYPE,
+ TmfBaseAspects.getEventTypeAspect(),
new BtfTargetAspect(),
new TmfContentFieldAspect(BtfColumnNames.TARGET_INSTANCE.toString(), BtfColumnNames.TARGET_INSTANCE.toString()),
new TmfContentFieldAspect(BtfColumnNames.EVENT.toString(), BtfColumnNames.EVENT.toString()),
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.project.model.ITmfPropertiesProvider;
*/
protected static final @NonNull Collection<@NonNull ITmfEventAspect<?>> CTF_ASPECTS =
ImmutableList.of(
- ITmfEventAspect.BaseAspects.TIMESTAMP,
+ TmfBaseAspects.getTimestampAspect(),
new CtfChannelAspect(),
new CtfCpuAspect(),
- ITmfEventAspect.BaseAspects.EVENT_TYPE,
- ITmfEventAspect.BaseAspects.CONTENTS
+ TmfBaseAspects.getEventTypeAspect(),
+ TmfBaseAspects.getContentsAspect()
);
/**
import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent;
import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEventContent;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect;
new TmfContentFieldAspect(GdbTraceEventContent.TRACE_FRAME, GdbTraceEventContent.TRACE_FRAME),
new TmfContentFieldAspect(GdbTraceEventContent.TRACEPOINT, GdbTraceEventContent.TRACEPOINT),
new GdbFileAspect(),
- ITmfEventAspect.BaseAspects.CONTENTS
+ TmfBaseAspects.getContentsAspect()
);
private static class GdbFileAspect implements ITmfEventAspect<String> {
import org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect.PcapSourceAspect;
import org.eclipse.tracecompass.internal.tmf.pcap.core.util.PcapEventFactory;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.project.model.ITmfPropertiesProvider;
private static final Collection<ITmfEventAspect<?>> PCAP_ASPECTS =
ImmutableList.of(
- ITmfEventAspect.BaseAspects.TIMESTAMP,
+ TmfBaseAspects.getTimestampAspect(),
PcapSourceAspect.INSTANCE,
PcapDestinationAspect.INSTANCE,
PcapReferenceAspect.INSTANCE,
PcapProtocolAspect.INSTANCE,
- ITmfEventAspect.BaseAspects.CONTENTS
+ TmfBaseAspects.getContentsAspect()
);
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
import org.eclipse.tracecompass.internal.tmf.pcap.core.signal.TmfPacketStreamSelectedSignal;
import org.eclipse.tracecompass.internal.tmf.pcap.core.trace.PcapTrace;
import org.eclipse.tracecompass.internal.tmf.pcap.ui.Activator;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.filter.model.ITmfFilterTreeNode;
import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterAndNode;
import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterAspectNode;
// Third stage - protocol + or
TmfFilterContainsNode protocolFilter = new TmfFilterContainsNode(and);
- protocolFilter.setEventAspect(ITmfEventAspect.BaseAspects.CONTENTS.forField(stream.getProtocol().getName()));
+ protocolFilter.setEventAspect(TmfBaseAspects.getContentsAspect().forField(stream.getProtocol().getName()));
protocolFilter.setTraceTypeId(TmfFilterAspectNode.BASE_ASPECT_ID);
protocolFilter.setValue(EMPTY_STRING);
TmfFilterOrNode or = new TmfFilterOrNode(and);
import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect;
import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterCompareNode;
import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterCompareNode.Type;
@Test
public void testMatchesTimestamp() {
- fFilter.setEventAspect(ITmfEventAspect.BaseAspects.TIMESTAMP);
+ fFilter.setEventAspect(TmfBaseAspects.getTimestampAspect());
fFilter.setType(Type.TIMESTAMP);
fFilter.setValue("0.000000002");
import java.util.regex.Pattern;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
/** The event aspects */
public static final @NonNull Collection<ITmfEventAspect<?>> ASPECTS =
ImmutableList.of(
- ITmfEventAspect.BaseAspects.TIMESTAMP,
+ TmfBaseAspects.getTimestampAspect(),
new TmfContentFieldAspect(Field.HOST, Field.HOST),
new TmfContentFieldAspect(Field.LOGGER, Field.LOGGER),
new TmfContentFieldAspect(Field.FILE, Field.FILE),
import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect;
import org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect;
ImmutableList.Builder<ITmfEventAspect<?>> builder = new ImmutableList.Builder<>();
/* Initialize the first default trace aspects */
- builder.add(ITmfEventAspect.BaseAspects.TIMESTAMP);
- builder.add(ITmfEventAspect.BaseAspects.EVENT_TYPE);
+ builder.add(TmfBaseAspects.getTimestampAspect());
+ builder.add(TmfBaseAspects.getEventTypeAspect());
/* Add custom aspects in between */
for (ITmfEventField field : fieldsArray) {
}
/* Add the big content aspect */
- builder.add(ITmfEventAspect.BaseAspects.CONTENTS);
+ builder.add(TmfBaseAspects.getContentsAspect());
/* Add the additional aspects */
builder.addAll(fAdditionalAspects);
fAspects = builder.build();
package org.eclipse.tracecompass.tmf.core.event.aspect;
-import java.util.List;
-
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-
-import com.google.common.collect.ImmutableList;
/**
* An aspect is a piece of information that can be extracted, directly or
*/
String EMPTY_STRING = ""; //$NON-NLS-1$
- /**
- * List of all common base aspects
- */
- public static final List<ITmfEventAspect<?>> BASE_ASPECTS =
- ImmutableList.of(
- BaseAspects.TIMESTAMP,
- BaseAspects.EVENT_TYPE,
- BaseAspects.CONTENTS,
- BaseAspects.TRACE_NAME
- );
- /**
- * Some basic aspects that all trace types should be able to use, using
- * methods found in {@link ITmfEvent}.
- */
- interface BaseAspects {
-
- /**
- * Aspect for the event timestamp
- */
- ITmfEventAspect<ITmfTimestamp> TIMESTAMP = new ITmfEventAspect<ITmfTimestamp>() {
- @Override
- public String getName() {
- return Messages.getMessage(Messages.AspectName_Timestamp);
- }
-
- @Override
- public String getHelpText() {
- return EMPTY_STRING;
- }
-
- @Override
- public @Nullable ITmfTimestamp resolve(ITmfEvent event) {
- return event.getTimestamp();
- }
- };
-
- /**
- * Aspect for the event type
- */
- ITmfEventAspect<String> EVENT_TYPE = new ITmfEventAspect<String>() {
- @Override
- public String getName() {
- return Messages.getMessage(Messages.AspectName_EventType);
- }
-
- @Override
- public String getHelpText() {
- return Messages.getMessage(Messages.AspectHelpText_EventType);
- }
-
- @Override
- public @Nullable String resolve(ITmfEvent event) {
- ITmfEventType type = event.getType();
- if (type == null) {
- return null;
- }
- return type.getName();
- }
- };
-
- /**
- * Aspect for the aggregated event contents (fields)
- */
- TmfEventFieldAspect CONTENTS = new TmfEventFieldAspect(Messages.getMessage(Messages.AspectName_Contents), null, new TmfEventFieldAspect.IRootField() {
- @Override
- public @Nullable ITmfEventField getRootField(ITmfEvent event) {
- return event.getContent();
- }
- }) {
- @Override
- public String getHelpText() {
- return Messages.getMessage(Messages.AspectHelpText_Contents);
- }
-
- };
-
- /**
- * Aspect for the trace's name (for experiments with many traces)
- */
- ITmfEventAspect<String> TRACE_NAME = new ITmfEventAspect<String>() {
- @Override
- public String getName() {
- return Messages.getMessage(Messages.AspectName_TraceName);
- }
-
- @Override
- public String getHelpText() {
- return Messages.getMessage(Messages.AspectHelpText_TraceName);
- }
-
- @Override
- public @Nullable String resolve(ITmfEvent event) {
- return event.getTrace().getName();
- }
- };
- }
-
/**
* Get the name of this aspect. This name will be user-visible and, as such,
* should be localized.
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 É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
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.event.aspect;
+
+import java.util.List;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Some basic aspects that all trace types should be able to use, using methods
+ * found in {@link ITmfEvent}.
+ *
+ * @author Alexandre Montplaisir
+ * @author Geneviève Bastien
+ * @since 2.0
+ */
+public final class TmfBaseAspects {
+
+ private static final ITmfEventAspect<ITmfTimestamp> TIMESTAMP_ASPECT = new ITmfEventAspect<ITmfTimestamp>() {
+ @Override
+ public String getName() {
+ return Messages.getMessage(Messages.AspectName_Timestamp);
+ }
+
+ @Override
+ public String getHelpText() {
+ return ITmfEventAspect.EMPTY_STRING;
+ }
+
+ @Override
+ public @Nullable ITmfTimestamp resolve(ITmfEvent event) {
+ return event.getTimestamp();
+ }
+ };
+
+ private static final ITmfEventAspect<String> EVENT_TYPE_ASPECT = new ITmfEventAspect<String>() {
+ @Override
+ public String getName() {
+ return Messages.getMessage(Messages.AspectName_EventType);
+ }
+
+ @Override
+ public String getHelpText() {
+ return Messages.getMessage(Messages.AspectHelpText_EventType);
+ }
+
+ @Override
+ public @Nullable String resolve(ITmfEvent event) {
+ ITmfEventType type = event.getType();
+ if (type == null) {
+ return null;
+ }
+ return type.getName();
+ }
+ };
+
+ private static final TmfEventFieldAspect CONTENTS_ASPECT = new TmfEventFieldAspect(Messages.getMessage(Messages.AspectName_Contents), null, new TmfEventFieldAspect.IRootField() {
+ @Override
+ public @Nullable ITmfEventField getRootField(ITmfEvent event) {
+ return event.getContent();
+ }
+ }) {
+ @Override
+ public String getHelpText() {
+ return Messages.getMessage(Messages.AspectHelpText_Contents);
+ }
+ };
+
+ private static final ITmfEventAspect<String> TRACE_NAME_ASPECT = new ITmfEventAspect<String>() {
+ @Override
+ public String getName() {
+ return Messages.getMessage(Messages.AspectName_TraceName);
+ }
+
+ @Override
+ public String getHelpText() {
+ return Messages.getMessage(Messages.AspectHelpText_TraceName);
+ }
+
+ @Override
+ public @Nullable String resolve(ITmfEvent event) {
+ return event.getTrace().getName();
+ }
+ };
+
+ private static final List<ITmfEventAspect<?>> BASE_ASPECTS = ImmutableList.of(
+ getTimestampAspect(),
+ getEventTypeAspect(),
+ getContentsAspect(),
+ getTraceNameAspect());
+
+ private TmfBaseAspects() {
+
+ }
+
+ /**
+ * Get the aspect for the event timestamp
+ *
+ * @return The timestamp aspect
+ */
+ public static ITmfEventAspect<ITmfTimestamp> getTimestampAspect() {
+ return TIMESTAMP_ASPECT;
+ }
+
+ /**
+ * Get the aspect for the event type
+ *
+ * @return The aspect for the event type
+ */
+ public static ITmfEventAspect<String> getEventTypeAspect() {
+ return EVENT_TYPE_ASPECT;
+ }
+
+ /**
+ * Get the aspect for the aggregated event contents (fields)
+ *
+ * @return The aspect for the aggregate event contents
+ */
+ public static TmfEventFieldAspect getContentsAspect() {
+ return CONTENTS_ASPECT;
+ }
+
+ /**
+ * Get the aspect for the trace's name (for experiments with many traces)
+ *
+ * @return The trace name aspect
+ */
+ public static ITmfEventAspect<String> getTraceNameAspect() {
+ return TRACE_NAME_ASPECT;
+ }
+
+ /**
+ * Get the list of all common base aspects
+ *
+ * @return the list of base aspects
+ */
+ public static List<ITmfEventAspect<?>> getBaseAspects() {
+ return BASE_ASPECTS;
+ }
+
+}
\ No newline at end of file
import java.util.Stack;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.event.aspect.TmfEventFieldAspect;
import org.eclipse.tracecompass.tmf.core.filter.model.ITmfFilterTreeNode;
traceTypeId = TmfTraceType.buildCompatibilityTraceTypeId(traceTypeId);
String name = atts.getValue(TmfFilterAspectNode.EVENT_ASPECT_ATTR);
if (TmfFilterAspectNode.BASE_ASPECT_ID.equals(traceTypeId)) {
- for (ITmfEventAspect<?> eventAspect : ITmfEventAspect.BASE_ASPECTS) {
+ for (ITmfEventAspect<?> eventAspect : TmfBaseAspects.getBaseAspects()) {
if (eventAspect.getName().equals(name)) {
node.setEventAspect(eventAspect);
node.setTraceTypeId(traceTypeId);
String field = atts.getValue(FIELD_ATTR);
if (field != null) {
if (field.equals(EVENT_FIELD_TIMESTAMP)) {
- node.setEventAspect(ITmfEventAspect.BaseAspects.TIMESTAMP);
+ node.setEventAspect(TmfBaseAspects.getTimestampAspect());
node.setTraceTypeId(TmfFilterAspectNode.BASE_ASPECT_ID);
} else if (field.equals(EVENT_FIELD_TYPE)) {
- node.setEventAspect(ITmfEventAspect.BaseAspects.EVENT_TYPE);
+ node.setEventAspect(TmfBaseAspects.getEventTypeAspect());
node.setTraceTypeId(TmfFilterAspectNode.BASE_ASPECT_ID);
} else if (field.equals(EVENT_FIELD_CONTENT)) {
- node.setEventAspect(ITmfEventAspect.BaseAspects.CONTENTS);
+ node.setEventAspect(TmfBaseAspects.getContentsAspect());
node.setTraceTypeId(TmfFilterAspectNode.BASE_ASPECT_ID);
} else {
- node.setEventAspect(ITmfEventAspect.BaseAspects.CONTENTS.forField(field));
+ node.setEventAspect(TmfBaseAspects.getContentsAspect().forField(field));
node.setTraceTypeId(TmfFilterAspectNode.BASE_ASPECT_ID);
}
}
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.ITmfLostEvent;
import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
*/
public static final @NonNull Collection<@NonNull ITmfEventAspect<?>> BASE_ASPECTS =
ImmutableList.of(
- ITmfEventAspect.BaseAspects.TIMESTAMP,
- ITmfEventAspect.BaseAspects.EVENT_TYPE,
- ITmfEventAspect.BaseAspects.CONTENTS
+ TmfBaseAspects.getTimestampAspect(),
+ TmfBaseAspects.getEventTypeAspect(),
+ TmfBaseAspects.getContentsAspect()
);
// ------------------------------------------------------------------------
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
import org.eclipse.tracecompass.internal.tmf.ui.editors.ITmfEventsEditorConstants;
import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
import org.eclipse.tracecompass.tmf.core.signal.TmfTimestampFormatUpdateSignal;
ImmutableSet.Builder<ITmfEventAspect<?>> builder = new ImmutableSet.Builder<>();
/* For experiments, we'll add a "trace name" aspect/column */
- builder.add(ITmfEventAspect.BaseAspects.TRACE_NAME);
+ builder.add(TmfBaseAspects.getTraceNameAspect());
String commonTraceType = getCommonTraceType(experiment);
if (commonTraceType != null) {
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.tracecompass.internal.tmf.ui.Messages;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.event.aspect.TmfEventFieldAspect;
import org.eclipse.tracecompass.tmf.core.filter.model.ITmfFilterTreeNode;
ArrayList<AspectItem> aspectList = new ArrayList<>();
aspectList.add(new AspectItem(Messages.FilterViewer_CommonCategory));
- for (ITmfEventAspect<?> aspect : ITmfEventAspect.BASE_ASPECTS) {
+ for (ITmfEventAspect<?> aspect : TmfBaseAspects.getBaseAspects()) {
aspectList.add(new AspectItem(aspect.getName(), aspect, TmfFilterAspectNode.BASE_ASPECT_ID));
}