Rename xxx.lttng to xxx.lttng.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.core / src / org / eclipse / linuxtools / lttng / event / LttngEventType.java
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
13 package org.eclipse.linuxtools.lttng.event;
14
15 import org.eclipse.linuxtools.tmf.event.*;
16
17 /**
18 * <b><u>LttngEventType</u></b><p>
19 *
20 * Lttng specific implementation of the TmfEventType.<p>
21 *
22 * This implementation add some attributes to the basic Tmf object.
23 */
24 public class LttngEventType extends TmfEventType {
25
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
37 private String tracefileName = null;
38 private Long cpuId = null;
39 private String markerName = null;
40 private int markerId = -1;
41
42 /**
43 * Default Constructor.<p>
44 *
45 */
46 public LttngEventType() {
47 super();
48 }
49
50 /**
51 * Default Constructor.<p>
52 *
53 */
54 public LttngEventType(String typeId, String[] labels) {
55 super(typeId, labels);
56 }
57
58 /**
59 * Constructor with parameters.<p>
60 *
61 * @param thisTracefileName Tracefile (channel) name in Ltt
62 * @param thisMarkerName Marker name in LTT
63 * @param thisMarkerfieldsName MarkerFields related to this marker
64 */
65 public LttngEventType(String thisTracefileName, Long thisCpuId, String thisMarkerName, int thisMarkerId, String[] thisMarkerfieldsName) {
66 super( thisTracefileName + "/" + thisCpuId + "/" + thisMarkerName, thisMarkerfieldsName); //$NON-NLS-1$ //$NON-NLS-2$
67
68 tracefileName = thisTracefileName;
69 cpuId = thisCpuId;
70 markerName = thisMarkerName;
71 markerId = thisMarkerId;
72 }
73
74 /**
75 * Copy constructor.<p>
76 *
77 * @param oldType Type we want to copy from
78 */
79 public LttngEventType(LttngEventType oldType) {
80 this(oldType.tracefileName, oldType.cpuId, oldType.markerName, oldType.markerId, oldType.getLabels());
81 }
82
83
84 public String getTracefileName() {
85 return tracefileName;
86 }
87
88 public Long getCpuId() {
89 return cpuId;
90 }
91
92 public String getMarkerName() {
93 return markerName;
94 }
95
96 public int getMarkerId() {
97 return markerId;
98 }
99
100 /**
101 * toString() method.
102 *
103 * @return TypeId (channel/marker) of the object
104 */
105 @Override
106 @SuppressWarnings("nls")
107 public String toString() {
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;
112 }
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);
120 clone.markerId = markerId;
121 return clone;
122 }
123
124 }
This page took 0.043328 seconds and 5 git commands to generate.