Fix for custom parsers
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng / src / org / eclipse / linuxtools / lttng / event / LttngEventType.java
CommitLineData
5d10d135
ASL
1/*******************************************************************************
2 * Copyright (c) 2009 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * William Bourque (wbourque@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.lttng.event;
14
15import org.eclipse.linuxtools.tmf.event.*;
16
17/**
07d9e2ee
FC
18 * <b><u>LttngEventType</u></b><p>
19 *
20 * Lttng specific implementation of the TmfEventType.<p>
21 *
5d10d135
ASL
22 * This implementation add some attributes to the basic Tmf object.
23 */
24public class LttngEventType extends TmfEventType {
28b94d61 25
4bf17f4a 26 private static final String DEFAULT_TYPE_ID = "Kernel Trace"; //$NON-NLS-1$
27 // These should match the column names in LTTng Events Table
28 public static final String TIMESTAMP_LABEL = "Timestamp"; //$NON-NLS-1$
29 public static final String TRACE_LABEL = "Trace"; //$NON-NLS-1$
30 public static final String MARKER_LABEL = "Marker"; //$NON-NLS-1$
31 public static final String CONTENT_LABEL = "Content"; //$NON-NLS-1$
32 private static final String[] DEFAULT_LABELS = {
33 TIMESTAMP_LABEL, TRACE_LABEL, MARKER_LABEL, CONTENT_LABEL
34 };
35 public static final LttngEventType DEFAULT_EVENT_TYPE = new LttngEventType(DEFAULT_TYPE_ID, DEFAULT_LABELS);
36
28b94d61
FC
37 private String tracefileName = null;
38 private Long cpuId = null;
39 private String markerName = null;
b12f4544 40 private int markerId = -1;
5d10d135
ASL
41
42 /**
28b94d61 43 * Default Constructor.<p>
5d10d135 44 *
28b94d61
FC
45 */
46 public LttngEventType() {
47 super();
48 }
49
4bf17f4a 50 /**
51 * Default Constructor.<p>
52 *
53 */
54 public LttngEventType(String typeId, String[] labels) {
55 super(typeId, labels);
56 }
57
28b94d61
FC
58 /**
59 * Constructor with parameters.<p>
07d9e2ee 60 *
28b94d61
FC
61 * @param thisTracefileName Tracefile (channel) name in Ltt
62 * @param thisMarkerName Marker name in LTT
63 * @param thisMarkerfieldsName MarkerFields related to this marker
5d10d135 64 */
b12f4544 65 public LttngEventType(String thisTracefileName, Long thisCpuId, String thisMarkerName, int thisMarkerId, String[] thisMarkerfieldsName) {
9c4eb5f7 66 super( thisTracefileName + "/" + thisCpuId + "/" + thisMarkerName, thisMarkerfieldsName); //$NON-NLS-1$ //$NON-NLS-2$
5d10d135 67
28b94d61
FC
68 tracefileName = thisTracefileName;
69 cpuId = thisCpuId;
70 markerName = thisMarkerName;
b12f4544 71 markerId = thisMarkerId;
5d10d135
ASL
72 }
73
3fbd810a 74 /**
07d9e2ee 75 * Copy constructor.<p>
3fbd810a 76 *
07d9e2ee 77 * @param oldType Type we want to copy from
3fbd810a
FC
78 */
79 public LttngEventType(LttngEventType oldType) {
b12f4544 80 this(oldType.tracefileName, oldType.cpuId, oldType.markerName, oldType.markerId, oldType.getLabels());
3fbd810a
FC
81 }
82
5d10d135 83
28b94d61
FC
84 public String getTracefileName() {
85 return tracefileName;
5d10d135
ASL
86 }
87
28b94d61 88 public Long getCpuId() {
5d10d135
ASL
89 return cpuId;
90 }
91
92 public String getMarkerName() {
93 return markerName;
94 }
95
b12f4544
FC
96 public int getMarkerId() {
97 return markerId;
98 }
99
5d10d135
ASL
100 /**
101 * toString() method.
102 *
28b94d61 103 * @return TypeId (channel/marker) of the object
5d10d135 104 */
6d848cce 105 @Override
3b38ea61 106 @SuppressWarnings("nls")
6d848cce 107 public String toString() {
28b94d61
FC
108 // *** TODO ***
109 // This is used as-it in the events view, so we won't change its format.
110 // ...but maybe we should?
111 return tracefileName + "/" + cpuId.toString() + "/" + markerName;
5d10d135 112 }
1a971e96
FC
113
114 @Override
115 public LttngEventType clone() {
116 LttngEventType clone = (LttngEventType) super.clone();
117 clone.tracefileName = new String(tracefileName);
118 clone.cpuId = new Long(cpuId);
119 clone.markerName = new String(markerName);
b12f4544 120 clone.markerId = markerId;
1a971e96
FC
121 return clone;
122 }
123
5d10d135 124}
This page took 0.03541 seconds and 5 git commands to generate.